You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/12/24 00:01:00 UTC

[jira] [Updated] (IMPALA-2262) Improve timestamp format parser to support more formats and make it consistent with Hive

     [ https://issues.apache.org/jira/browse/IMPALA-2262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Armstrong updated IMPALA-2262:
----------------------------------
    Description: 
Setup:
{noformat}
create table string_time_table (date_last_changed string);
insert into string_time_table values ('06/09/2006 01:25 PM');
{noformat}

Hive:
{noformat}
SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
+----------------------+----------------------+--+ 
| date_last_changed | _c1 | 
+----------------------+----------------------+--+ 
| 06/09/2006 01:25 PM | 2006-06-09 13:25:00 | 
+----------------------+----------------------+--+ 
{noformat}
Impala:

{noformat}
SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
Query: select date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table 
WARNINGS: Bad date/time conversion format: MM/dd/yyyy hh:mm a 
{noformat}

We don't support am/pm based formats [1]. I think we should make impala's usage consistent with hive

[1] https://github.com/cloudera/Impala/blob/cdh5-trunk/be/src/runtime/timestamp-parse-util.h#L205

  was:
Hive:

SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
+----------------------+----------------------+--+ 
| date_last_changed | _c1 | 
+----------------------+----------------------+--+ 
| 06/09/2006 01:25 PM | 2006-06-09 13:25:00 | 
+----------------------+----------------------+--+ 

Impala:

SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
Query: select date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table 
WARNINGS: Bad date/time conversion format: MM/dd/yyyy hh:mm a 


We don't support am/pm based formats [1]. I think we should make impala's usage consistent with hive

[1] https://github.com/cloudera/Impala/blob/cdh5-trunk/be/src/runtime/timestamp-parse-util.h#L205


> Improve timestamp format parser to support more formats and make it consistent with Hive
> ----------------------------------------------------------------------------------------
>
>                 Key: IMPALA-2262
>                 URL: https://issues.apache.org/jira/browse/IMPALA-2262
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend
>    Affects Versions: Impala 2.2.4
>            Reporter: Bharath Vissapragada
>            Priority: Minor
>
> Setup:
> {noformat}
> create table string_time_table (date_last_changed string);
> insert into string_time_table values ('06/09/2006 01:25 PM');
> {noformat}
> Hive:
> {noformat}
> SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
> +----------------------+----------------------+--+ 
> | date_last_changed | _c1 | 
> +----------------------+----------------------+--+ 
> | 06/09/2006 01:25 PM | 2006-06-09 13:25:00 | 
> +----------------------+----------------------+--+ 
> {noformat}
> Impala:
> {noformat}
> SELECT date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table; 
> Query: select date_last_changed, FROM_UNIXTIME(UNIX_TIMESTAMP(date_last_changed,'MM/dd/yyyy hh:mm a')) FROM string_time_table 
> WARNINGS: Bad date/time conversion format: MM/dd/yyyy hh:mm a 
> {noformat}
> We don't support am/pm based formats [1]. I think we should make impala's usage consistent with hive
> [1] https://github.com/cloudera/Impala/blob/cdh5-trunk/be/src/runtime/timestamp-parse-util.h#L205



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org