[ 
https://issues.apache.org/jira/browse/ARROW-18337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicola Crane updated ARROW-18337:
---------------------------------
    Summary: [R] Possible undesirable handling of POSIXlt objects  (was: 
Possible undesirable handling of POSIXlt objects)

> [R] Possible undesirable handling of POSIXlt objects
> ----------------------------------------------------
>
>                 Key: ARROW-18337
>                 URL: https://issues.apache.org/jira/browse/ARROW-18337
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Danielle Navarro
>            Priority: Major
>
> In the course of updating documentation, I noticed that it is possible to 
> create an Arrow array of POSIXlt objects from R, but not a scalar. 
> https://github.com/apache/arrow/pull/14514#discussion_r1016078081
> This works:
> {code:r}
> tm <- as.POSIXlt(c(Sys.time(), Sys.time()))
> arrow::Array$create(tm)
> {code}
> This fails:
> {code:r}
> arrow::Scalar$create(as.POSIXlt(Sys.time()))
> {code}
> It's possible to manually convert a POSIXlt object to a struct scalar like 
> this:
> {code:r}
> df <- as.data.frame(unclass(as.POSIXlt(Sys.time())))
> arrow::Scalar$create(df, 
>               type = struct(
>                 sec = float32(), 
>                 min = int32(),
>                 hour = int32(),
>                 mday = int32(),
>                 mon = int32(),
>                 year = int32(),
>                 wday = int32(),
>                 yday = int32(),
>                 isdst = int32(),
>                 zone = utf8(),
>                 gmtoff = int32()
>               ))
> {code}
> although this does not seem precisely the same as the behaviour of 
> Array$create() which creates an extension type?
> It was unclear to us ([~thisisnic] and myself) whether the current behaviour 
> was desirable, so it seemed sensible to open an issue! 
> Related issue:
> https://issues.apache.org/jira/browse/ARROW-18263



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to