You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/06/10 14:52:00 UTC

[jira] [Commented] (ARROW-12809) [C++] Add StrptimeOptions defaults

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

Antoine Pitrou commented on ARROW-12809:
----------------------------------------

Well, you just need to cast from string to timestamp if you have ISO-formatted timestamps. It's more flexible than strptime-based parsing too:
{code:python}
>>> arr = pa.array(['1999-01-28', '1971-03-05 01:00:00', '2001-12-02 12:34:56.123456'])
>>> arr.cast(pa.timestamp('ns'))
<pyarrow.lib.TimestampArray object at 0x7f8e5a1526e0>
[
  1999-01-28 00:00:00.000000000,
  1971-03-05 01:00:00.000000000,
  2001-12-02 12:34:56.123456000
]
{code}


> [C++] Add StrptimeOptions defaults
> ----------------------------------
>
>                 Key: ARROW-12809
>                 URL: https://issues.apache.org/jira/browse/ARROW-12809
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++
>            Reporter: Neal Richardson
>            Priority: Major
>
> Per https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_string.cc#L1744 there are no default options for strptime (format, unit). But the TimestampType constructor has a default unit of milliseconds (https://github.com/apache/arrow/blob/master/cpp/src/arrow/type.h#L1236), and a reasonable default for {{format}} would be ISO8601. 
> cc [~bkietz] [~wesm] for opinions as the authors of this code (according to {{git blame}})



--
This message was sent by Atlassian Jira
(v8.3.4#803005)