[
https://issues.apache.org/jira/browse/ARROW-16627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17559091#comment-17559091
]
Rok Mihevc commented on ARROW-16627:
------------------------------------
Seems like strptime has some sort of consistent behaviour here:
{code:python}
import pyarrow as pa
sarr = pa.array(["2022-01-00", "2022-01-01"], type=pa.string())
pa.compute.strptime(sarr, format="%Y-%m-%d", unit="s")
<pyarrow.lib.TimestampArray object at 0x121b98ac0>
[
2021-12-31 00:00:00,
2022-01-01 00:00:00
]{code}
Definitely unexpected enough to be a bug.
> [C++] Support parsing of "2020-01" into `2020-01-01`
> ----------------------------------------------------
>
> Key: ARROW-16627
> URL: https://issues.apache.org/jira/browse/ARROW-16627
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++, R
> Affects Versions: 8.0.0
> Reporter: Dragoș Moldovan-Grünfeld
> Priority: Major
>
> Originated as part of the
> [review|https://github.com/apache/arrow/pull/13196#discussion_r878229869] for
> the ARROW-16407 [PR|https://github.com/apache/arrow/pull/13196].
> Currently we get a surprising output when parsing of {{%Y-%m}} strings such
> as {{"2020-01"}} - see reprex below.
> {code:r}
> library(arrow, warn.conflicts = FALSE)
> call_function(
> "strptime",
> Array$create("2020-01"),
> options = list(
> format = "%Y-%m",
> unit = 0L
> )
> )
> #> Array
> #> <timestamp[s]>
> #> [
> #> 2019-12-31 00:00:00
> #> ]
> {code}
> I'm not sure if this would be useful somewhere else, but we could definitely
> use this to remove some workarounds in the R bindings.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)