hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pxi...@apache.org
Subject hive git commit: HIVE-13837: current_timestamp() output format is different in some cases (Pengcheng Xiong, reviewed by Jason Dere)
Date Tue, 31 May 2016 05:30:41 GMT
Repository: hive
Updated Branches:
  refs/heads/master 8136a10c1 -> 4d988b195


HIVE-13837: current_timestamp() output format is different in some cases (Pengcheng Xiong,
reviewed by Jason Dere)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4d988b19
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4d988b19
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4d988b19

Branch: refs/heads/master
Commit: 4d988b195d9120e21575e7f64c711019295cb805
Parents: 8136a10
Author: Pengcheng Xiong <pxiong@apache.org>
Authored: Mon May 30 22:26:00 2016 -0700
Committer: Pengcheng Xiong <pxiong@apache.org>
Committed: Mon May 30 22:30:09 2016 -0700

----------------------------------------------------------------------
 .../calcite/translator/ASTBuilder.java          |   2 +-
 ql/src/test/queries/clientpositive/timestamp.q  |  10 ++
 .../test/results/clientpositive/timestamp.q.out | 180 +++++++++++++++++++
 3 files changed, 191 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/4d988b19/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
index 682d0cb..2e1384a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
@@ -248,7 +248,7 @@ class ASTBuilder {
     case TIMESTAMP: {
       val = literal.getValue();
       type = HiveParser.TOK_TIMESTAMPLITERAL;
-      DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+      DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
       val = df.format(((Calendar) val).getTime());
       val = "'" + val + "'";
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/4d988b19/ql/src/test/queries/clientpositive/timestamp.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/timestamp.q b/ql/src/test/queries/clientpositive/timestamp.q
new file mode 100644
index 0000000..4a04080
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamp.q
@@ -0,0 +1,10 @@
+set hive.mapred.mode=nonstrict;
+-- SORT_QUERY_RESULTS
+
+explain select cast('2011-01-01 01:01:01' as timestamp) as c from src union select cast('2011-01-01
01:01:01' as timestamp) as c from src limit 5;
+
+select cast('2011-01-01 01:01:01' as timestamp) as c from src union select cast('2011-01-01
01:01:01' as timestamp) as c from src limit 5;
+
+explain select cast('2011-01-01 01:01:01.123' as timestamp) as c from src union select cast('2011-01-01
01:01:01.123' as timestamp) as c from src limit 5;
+
+select cast('2011-01-01 01:01:01.123' as timestamp) as c from src union select cast('2011-01-01
01:01:01.123' as timestamp) as c from src limit 5;

http://git-wip-us.apache.org/repos/asf/hive/blob/4d988b19/ql/src/test/results/clientpositive/timestamp.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/timestamp.q.out b/ql/src/test/results/clientpositive/timestamp.q.out
new file mode 100644
index 0000000..7c08ec8
--- /dev/null
+++ b/ql/src/test/results/clientpositive/timestamp.q.out
@@ -0,0 +1,180 @@
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+explain select cast('2011-01-01 01:01:01' as timestamp) as c from src union select cast('2011-01-01
01:01:01' as timestamp) as c from src limit 5
+PREHOOK: type: QUERY
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+explain select cast('2011-01-01 01:01:01' as timestamp) as c from src union select cast('2011-01-01
01:01:01' as timestamp) as c from src limit 5
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats:
COMPLETE
+            Select Operator
+              Statistics: Num rows: 500 Data size: 20000 Basic stats: COMPLETE Column stats:
COMPLETE
+              Union
+                Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                Select Operator
+                  Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                  Group By Operator
+                    keys: 2011-01-01 01:01:01.0 (type: timestamp)
+                    mode: hash
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: timestamp)
+                      Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column
stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats:
COMPLETE
+            Select Operator
+              Statistics: Num rows: 500 Data size: 20000 Basic stats: COMPLETE Column stats:
COMPLETE
+              Union
+                Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                Select Operator
+                  Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                  Group By Operator
+                    keys: 2011-01-01 01:01:01.0 (type: timestamp)
+                    mode: hash
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: timestamp)
+                      Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column
stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: timestamp)
+          mode: mergepartial
+          outputColumnNames: _col0
+          Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+          Select Operator
+            expressions: 2011-01-01 01:01:01.0 (type: timestamp)
+            outputColumnNames: _col0
+            Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+            Limit
+              Number of rows: 5
+              Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 5
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select cast('2011-01-01 01:01:01' as timestamp) as c from src union select
cast('2011-01-01 01:01:01' as timestamp) as c from src limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select cast('2011-01-01 01:01:01' as timestamp) as c from src union select
cast('2011-01-01 01:01:01' as timestamp) as c from src limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+2011-01-01 01:01:01
+PREHOOK: query: explain select cast('2011-01-01 01:01:01.123' as timestamp) as c from src
union select cast('2011-01-01 01:01:01.123' as timestamp) as c from src limit 5
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select cast('2011-01-01 01:01:01.123' as timestamp) as c from src
union select cast('2011-01-01 01:01:01.123' as timestamp) as c from src limit 5
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats:
COMPLETE
+            Select Operator
+              Statistics: Num rows: 500 Data size: 20000 Basic stats: COMPLETE Column stats:
COMPLETE
+              Union
+                Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                Select Operator
+                  Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                  Group By Operator
+                    keys: 2011-01-01 01:01:01.123 (type: timestamp)
+                    mode: hash
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: timestamp)
+                      Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column
stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+          TableScan
+            alias: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats:
COMPLETE
+            Select Operator
+              Statistics: Num rows: 500 Data size: 20000 Basic stats: COMPLETE Column stats:
COMPLETE
+              Union
+                Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                Select Operator
+                  Statistics: Num rows: 1000 Data size: 40000 Basic stats: COMPLETE Column
stats: COMPLETE
+                  Group By Operator
+                    keys: 2011-01-01 01:01:01.123 (type: timestamp)
+                    mode: hash
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: timestamp)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: timestamp)
+                      Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column
stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: timestamp)
+          mode: mergepartial
+          outputColumnNames: _col0
+          Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+          Select Operator
+            expressions: 2011-01-01 01:01:01.123 (type: timestamp)
+            outputColumnNames: _col0
+            Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+            Limit
+              Number of rows: 5
+              Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats:
COMPLETE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 5
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select cast('2011-01-01 01:01:01.123' as timestamp) as c from src union select
cast('2011-01-01 01:01:01.123' as timestamp) as c from src limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select cast('2011-01-01 01:01:01.123' as timestamp) as c from src union
select cast('2011-01-01 01:01:01.123' as timestamp) as c from src limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123


Mime
View raw message