Skip to content

[R] Cryptic error when creating Arrow array from POSIXct with invalid time zones #40886

@Wainberg

Description

@Wainberg

Describe the bug, including details regarding any error messages, version, and platform.

POSIXct is tricky because you can construct one with an invalid timezone and it won't give an error until you print it:

> a = as.POSIXct(1, NA)
> print(a)
Error in as.POSIXlt.POSIXct(x, tz) : invalid 'tz' value

But at least the error itself is easily understandable. When you try to create an Arrow array from such a POSIXct, you instead get a cryptic error:

> arrow::Array$create(as.POSIXct(1, 1))
Error in vec_to_Array(x, type) :
  STRING_ELT() can only be applied to a 'character vector', not a 'double'
> arrow::Array$create(as.POSIXct(1, NA))
Error in vec_to_Array(x, type) :
  STRING_ELT() can only be applied to a 'character vector', not a 'logical'

Component(s)

R

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions