[
https://issues.apache.org/jira/browse/DRILL-5002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16055280#comment-16055280
]
Vitalii Diravka commented on DRILL-5002:
----------------------------------------
One more hive built-in function, which relies on local timezone and returns
wrong result for date and timestamp parameters while using in Drill.
{code}
0: jdbc:drill:zk=local> select datediff(date '1996-03-01', timestamp
'1997-02-10 17:32:00.0') DATEDIFF, TIMEOFDAY() TIMEOFDAY from (VALUES(1));
+-----------+----------------------------------+
| DATEDIFF | TIMEOFDAY |
+-----------+----------------------------------+
| -346 | 2017-06-20 13:43:28.913 Etc/UCT |
+-----------+----------------------------------+
1 row selected (1.648 seconds)
{code}
{code}
0: jdbc:drill:zk=local> select datediff(date '1996-03-01', timestamp
'1997-02-10 17:32:00.0') DATEDIFF, TIMEOFDAY() TIMEOFDAY from (VALUES(1));
+-----------+----------------------------------------------+
| DATEDIFF | TIMEOFDAY |
+-----------+----------------------------------------------+
| -347 | 2017-06-20 06:42:11.403 America/Los_Angeles |
+-----------+----------------------------------------------+
1 row selected (0.136 seconds)
{code}
> Using hive's date functions on top of date column gives wrong results for
> local time-zone
> -----------------------------------------------------------------------------------------
>
> Key: DRILL-5002
> URL: https://issues.apache.org/jira/browse/DRILL-5002
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Hive, Storage - Parquet
> Reporter: Rahul Challapalli
> Assignee: Vitalii Diravka
> Priority: Critical
> Attachments: 0_0_0.parquet
>
>
> git.commit.id.abbrev=190d5d4
> Wrong Result 1 :
> {code}
> select l_shipdate, `month`(l_shipdate) from cp.`tpch/lineitem.parquet` where
> l_shipdate = date '1994-02-01' limit 2;
> +-------------+---------+
> | l_shipdate | EXPR$1 |
> +-------------+---------+
> | 1994-02-01 | 1 |
> | 1994-02-01 | 1 |
> +-------------+---------+
> {code}
> Wrong Result 2 :
> {code}
> select l_shipdate, `day`(l_shipdate) from cp.`tpch/lineitem.parquet` where
> l_shipdate = date '1998-06-02' limit 2;
> +-------------+---------+
> | l_shipdate | EXPR$1 |
> +-------------+---------+
> | 1998-06-02 | 1 |
> | 1998-06-02 | 1 |
> +-------------+---------+
> {code}
> Correct Result :
> {code}
> select l_shipdate, `month`(l_shipdate) from cp.`tpch/lineitem.parquet` where
> l_shipdate = date '1998-06-02' limit 2;
> +-------------+---------+
> | l_shipdate | EXPR$1 |
> +-------------+---------+
> | 1998-06-02 | 6 |
> | 1998-06-02 | 6 |
> +-------------+---------+
> {code}
> It looks like we are getting wrong results when the 'day' is '01'. I only
> tried month and day hive functions....but wouldn't be surprised if they have
> similar issues too.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)