apache / apache/arrow

[R] [C++] Should strptime support a partial format?

Open
#31,254 16 comments 0 reactions 0 assignees View on GitHub
Component: C++ Component: R Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 18h
Merged PRs (30d)
91

Description

In base R we can use `strptime` to parse and extract parts from a datetime by passing a restricted format.
```r

> strptime("2012-05-25 18:45:32", format = "%Y-%m-%d")
[1] "2012-05-25 BST"
> strptime("2012-05-25 18:45:32", format = "%Y-%m-%d %H")
[1] "2012-05-25 18:00:00 BST
```

**Reporter**: [Dragoș Moldovan-Grünfeld](https://issues.apache.org/jira/browse/ARROW-15813) / @dragosmg
**Watchers**: [Rok Mihevc](https://issues.apache.org/jira/browse/ARROW-15813) / @rok
#### Related issues:
- [[C++] Support parsing of "2020-01" into `2020-01-01`](https://github.com/apache/arrow/issues/31979) (is related to)
- [[C++] Add error handling option to StrptimeOptions](https://github.com/apache/arrow/issues/20115) (depends upon)

**Note**: *This issue was originally created as [ARROW-15813](https://issues.apache.org/jira/browse/ARROW-15813). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start with the partial-format examples in the issue and review related issues #31979 and #20115 to understand the intended parsing and error-handling behavior. Done means the C++ strptime behavior for restricted formats is defined and covered by tests matching the requested R-style results.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, r
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.