[ 
https://issues.apache.org/jira/browse/ARROW-18337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17635382#comment-17635382
 ] 

Dewey Dunnington commented on ARROW-18337:
------------------------------------------

The backtrace of the ValueOrDie is:


{code:java}
/Users/dewey/Desktop/rscratch/arrow/cpp/src/arrow/result.cc:28: ValueOrDie 
called on an error: NotImplemented: construction from scalar of type POSIXlt of 
length 0
/Users/dewey/Desktop/rscratch/arrow/cpp/src/arrow/array/util.cc:545  
VisitTypeInline(*scalar_.type, this)
0   libarrow.1100.0.0.dylib             0x000000011b3a9d0c 
_ZN5arrow4util7CerrLogD2Ev + 236
1   libarrow.1100.0.0.dylib             0x000000011b3a9c18 
_ZN5arrow4util7CerrLogD0Ev + 12
2   libarrow.1100.0.0.dylib             0x000000011b3a9bb4 
_ZN5arrow4util8ArrowLogD1Ev + 48
3   libarrow.1100.0.0.dylib             0x000000011b2862a0 
_ZN5arrow8internal17InvalidValueOrDieERKNS_6StatusE + 244
4   libarrow.1100.0.0.dylib             0x000000011b28a0d8 
_ZNK5arrow6Scalar8ToStringEv + 792
5   arrow.so                            0x000000010c064fac 
_arrow_Scalar__ToString + 108
6   libR.dylib                          0x0000000102f89be4 R_doDotCall + 1572
{code}


> [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