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

Vitalii Diravka commented on DRILL-5002:
----------------------------------------

[~rkins] I tried to use some hive functions with timestamp values and got the 
correct results:

{code}
0: jdbc:drill:zk=local> select `hour`(current_timestamp), 
`minute`(current_timestamp), `second`(current_timestamp) from (VALUES(1));
+---------+---------+---------+
| EXPR$0  | EXPR$1  | EXPR$2  |
+---------+---------+---------+
| 17      | 12      | 34      |
+---------+---------+---------+
1 row selected (0.119 seconds)
{code}
And parquet file generated with hive:
{code}
0: jdbc:drill:zk=local> alter session set planner.enable_decimal_data_type 
=true;
0: jdbc:drill:zk=local> alter session set 
store.parquet.reader.int96_as_timestamp = true;

0: jdbc:drill:zk=local> select timestamp_field, `year`(timestamp_field), 
`month`(timestamp_field), `day`(timestamp_field),`hour`(timestamp_field), 
`minute`(timestamp_field), `second`(timestamp_field) from 
dfs.`/home/vitalii/IdeaProjects/drill-fork/exec/java-exec/src/test/resources/parquet/part1/hive_all_types.parquet`
 where timestamp_field is not null;
+------------------------+---------+---------+---------+---------+---------+---------+
|    timestamp_field     | EXPR$1  | EXPR$2  | EXPR$3  | EXPR$4  | EXPR$5  | 
EXPR$6  |
+------------------------+---------+---------+---------+---------+---------+---------+
| 2013-07-06 00:01:00.0  | 2013    | 7       | 6       | 0       | 1       | 0  
     |
+------------------------+---------+---------+---------+---------+---------+---------+
1 row selected (0.324 seconds)
{code}

Could you provide use case to reproduce the issue or raise a new jira?
Because currently it looks like that the issue was gone.

> Using hive's date functions on top of date column in parquet gives wrong 
> results
> --------------------------------------------------------------------------------
>
>                 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
>
> 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.3.4#6332)

Reply via email to