[ https://issues.apache.org/jira/browse/IMPALA-8703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16933681#comment-16933681 ]
ASF subversion and git services commented on IMPALA-8703: --------------------------------------------------------- Commit bca1b43efb72d839962f9e6999ca747fca7f17d9 in impala's branch refs/heads/master from Gabor Kaszab [ https://gitbox.apache.org/repos/asf?p=impala.git;h=bca1b43 ] IMPALA-8703: ISO:SQL:2016 datetime patterns - Milestone 1 This enhancement introduces FORMAT clause for CAST() operator that is applicable for casts between string types and timestamp types. Instead of accepting SimpleDateFormat patterns the FORMAT clause supports datetime patterns following the ISO:SQL:2016 standard. Note, the CAST() operator without the FORMAT clause still uses Impala's implementation of SimpleDateFormat handling. Similarly, the existing conversion functions such as to_timestamp(), from_timestamp() etc. remain unchanged and use SimpleDateFormat. Contrary to how these functions work the FORMAT clause must specify a string literal and cannot be used with any other kind of a string expression. Milestone 1 contains all the format tokens covered by the SQL standard. Further milestones will add more functionality on top of this list to cover functionality provided by other RDBMS systems. List of tokens implemented by this change: - YYYY, YYY, YY, Y: Year tokens - RRRR, RR: Round year tokens - MM: Month (1-12) - DD: Day (1-31) - DDD: Day of year (1-366) - HH, HH12: Hour of day (1-12) - HH24: Hour of day (0-23) - MI: Minute (0-59) - SS: Second (0-59) - SSSSS: Second of day (0-86399) - FF, FF1, ..., FF9: Fractional second - AM, PM, A.M., P.M.: Meridiem indicators - TZH: Timezone hour (-99-+99) - TZM: Timezone minute (0-99) - Separators: - . / , ' ; : space - ISO8601 date indicators (T, Z) Some notes about the matching algorithm: - The parsing algorithm uses these tokens in a case insensitive manner. - The separators are interchangeable with each other. For example a '-' separator in the format will match with a '.' character in the input. - The length of the separator sequences is handled flexibly meaning that a single separator character in the format for instance would match with a multi-separator sequence in the input. - In a string type to timestamp conversion the timezone offset tokens are parsed, expected to match with the input but they don't adjust the result as the input is already expected to be in UTC format. Usage example: SELECT CAST('01-02-2019' AS TIMESTAMP FORMAT 'MM-DD-YYYY'); SELECT CAST('2019.10.10 13:30:40.123456 +01:30' AS TIMESTAMP FORMAT 'YYYY-MM-DD HH24:MI:SS.FF9 TZH:TZM'); SELECT CAST(timestamp_column as STRING FORMAT "YYYY MM HH12 YY") from some_table; Change-Id: I19d8d097a45ae6f103b6cd1b2d81aad38dfd9e23 Reviewed-on: http://gerrit.cloudera.org:8080/13722 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> > SQL:2016 datetime patterns - Milestone 1 > ---------------------------------------- > > Key: IMPALA-8703 > URL: https://issues.apache.org/jira/browse/IMPALA-8703 > Project: IMPALA > Issue Type: Sub-task > Components: Backend, Frontend > Affects Versions: Impala 2.2.4 > Reporter: Gabor Kaszab > Assignee: Gabor Kaszab > Priority: Critical > > Design doc for SQL:2016 datetime patterns: > https://docs.google.com/document/d/1V7k6-lrPGW7_uhqM-FhKl3QsxwCRy69v2KIxPsGjc1k/ > Milestone 1 content: > - Introduce FORMAT clause for CAST() > - Implement basic SQL:2016 datetime patterns to comply with the standard. For > more details check the document above. > - Use the new SQL:2016 pattern handling for CAST(.. FORMAT..) -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org