hereR icon indicating copy to clipboard operation
hereR copied to clipboard

Connection returns an empty data table when some fields are NULL (since data.table 1.15.0)

Open gregleleu opened this issue 1 year ago • 2 comments

data.table no longer fills in rows with NA when some of the values are NULL since 1.15.0. This broke connection:

  • empty tables are returned
  • Leads to flexpolyline::decode_sf being called on a NULL
  • returning "Invalid format version"

This pull fixes that by recreating the rlang operator %||% and using it to avoid nulls. Maybe not exactly your philosophy, and maybe needs to be replicated in other places, but a first step towards resolution :)

gregleleu avatar Mar 14 '24 23:03 gregleleu

Hi @gregleleu, thanks for reporting.

Can you post a reproducible example, where this error occurs?

In the tests everything seems to work fine with data.table version 1.15.2.

Thanks!

munterfi avatar Mar 16 '24 12:03 munterfi

Sure:

from <- st_as_sfc("POINT (-0.074385 51.41419)", crs = 4326) %>% st_as_sf()
to   <- st_as_sfc("POINT (-0.072941 51.4144)", crs = 4326) %>% st_as_sf()

hereR::connection(
          origin = from,
          destination = to,
          datetime = as.POSIXct("2024-03-13 08:00:00 UTC"),
          results = 1,
          summary = FALSE)

gregleleu avatar Mar 16 '24 21:03 gregleleu