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 2020/10/19 15:31:00 UTC

[jira] [Commented] (ARROW-10337) More liberal parsing of ISO8601 timestamps with fractional seconds

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

Antoine Pitrou commented on ARROW-10337:
----------------------------------------

Thanks for the report. I agree a PR would be welcome :-)

> More liberal parsing of ISO8601 timestamps with fractional seconds
> ------------------------------------------------------------------
>
>                 Key: ARROW-10337
>                 URL: https://issues.apache.org/jira/browse/ARROW-10337
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Frank Smith
>            Assignee: Frank Smith
>            Priority: Minor
>
> The current ISO8601 timestamp parser assumes MILLI timestamps have 3 decimal places, MICRO have 6 and NANO have 9. From ParseTimestampISO8601 in cpp/src/arrow/util/value_parsing.h:
> {{ // We allow the following formats for all units:}}
> {{ // - "YYYY-MM-DD"}}
> {{ // - "YYYY-MM-DD[ T]hh"}}
> {{ // - "YYYY-MM-DD[ T]hhZ"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm"}}
> {{ // - "YYYY-MM-DD[ T]hh:mmZ"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ssZ"}}
> {{ //}}
> {{ // We allow the following formats for unit==MILLI:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.mmm"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.mmmZ"}}
> {{ //}}
> {{ // We allow the following formats for unit==MICRO:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.uuuuuu"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.uuuuuuZ"}}
> {{ //}}
> {{ // We allow the following formats for unit==NANO:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.nnnnnnnnn"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.nnnnnnnnnZ"}}
> {{ //}}
> I propose that we change the parser to accept 1 to 3 digits for MILLI, 1 to 6 digits for MICRO, and 1 to 9 digits for NANO, as follows:
> {{ // We allow the following formats for all units:}}
> {{ // - "YYYY-MM-DD"}}
> {{ // - "YYYY-MM-DD[ T]hhZ?"}}
> {{ // - "YYYY-MM-DD[ T]hh:mmZ?"}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ssZ?"}}
> {{ //}}
> {{ // We allow the following formats for unit == MILLI, MICRO, or NANO:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.s\{1,3}Z?"}}
> {{ //}}
> {{ // We allow the following formats for unit == MICRO, or NANO:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.s\{4,6}Z?"}}
> {{ //}}
> {{ // We allow the following formats for unit == NANO:}}
> {{ // - "YYYY-MM-DD[ T]hh:mm:ss.s\{7,9}Z?"}}
> This will allow for parsing of timestamps when e.g. a CSV file does not write timestamps with trailing zeroes.
> I am almost complete implementing this functionality, so a PR will be following soon.
>  
>  
>   



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