hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xu...@apache.org
Subject [46/55] [abbrv] hive git commit: HIVE-11973: IN operator fails when the column type is DATE (Yongzhi via Jimmy)
Date Wed, 28 Oct 2015 12:11:39 GMT
HIVE-11973: IN operator fails when the column type is DATE (Yongzhi via Jimmy)


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

Branch: refs/heads/spark
Commit: 601a48122992337ceca8e4042948b3a16334fa24
Parents: ccdd174
Author: Jimmy Xiang <jxiang@cloudera.com>
Authored: Tue Oct 27 09:09:55 2015 -0700
Committer: Jimmy Xiang <jxiang@cloudera.com>
Committed: Tue Oct 27 09:27:46 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hive/ql/exec/FunctionRegistry.java   |  6 ++
 .../test/queries/clientpositive/selectindate.q  |  9 +++
 .../results/clientpositive/selectindate.q.out   | 70 ++++++++++++++++++++
 3 files changed, 85 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/601a4812/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index d0e6122..9316600 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -784,6 +784,12 @@ public final class FunctionRegistry {
       return PrimitiveCategory.STRING;
     }
 
+    if (pgA == PrimitiveGrouping.DATE_GROUP && pgB == PrimitiveGrouping.STRING_GROUP)
{
+      return PrimitiveCategory.STRING;
+    }
+    if (pgB == PrimitiveGrouping.DATE_GROUP && pgA == PrimitiveGrouping.STRING_GROUP)
{
+      return PrimitiveCategory.STRING;
+    }
     Integer ai = numericTypes.get(pcA);
     Integer bi = numericTypes.get(pcB);
     if (ai == null || bi == null) {

http://git-wip-us.apache.org/repos/asf/hive/blob/601a4812/ql/src/test/queries/clientpositive/selectindate.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/selectindate.q b/ql/src/test/queries/clientpositive/selectindate.q
new file mode 100644
index 0000000..00f6a5a
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/selectindate.q
@@ -0,0 +1,9 @@
+drop table if exists datetest;
+create table datetest(dValue date, iValue int);
+insert into datetest values('2000-03-22', 1);
+insert into datetest values('2001-03-22', 2);
+insert into datetest values('2002-03-22', 3);
+insert into datetest values('2003-03-22', 4);
+SELECT * FROM datetest WHERE dValue IN ('2000-03-22','2001-03-22');
+drop table datetest;
+

http://git-wip-us.apache.org/repos/asf/hive/blob/601a4812/ql/src/test/results/clientpositive/selectindate.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/selectindate.q.out b/ql/src/test/results/clientpositive/selectindate.q.out
new file mode 100644
index 0000000..defebe3
--- /dev/null
+++ b/ql/src/test/results/clientpositive/selectindate.q.out
@@ -0,0 +1,70 @@
+PREHOOK: query: drop table if exists datetest
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists datetest
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table datetest(dValue date, iValue int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@datetest
+POSTHOOK: query: create table datetest(dValue date, iValue int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@datetest
+PREHOOK: query: insert into datetest values('2000-03-22', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@datetest
+POSTHOOK: query: insert into datetest values('2000-03-22', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@datetest
+POSTHOOK: Lineage: datetest.dvalue EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+POSTHOOK: Lineage: datetest.ivalue EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+PREHOOK: query: insert into datetest values('2001-03-22', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__2
+PREHOOK: Output: default@datetest
+POSTHOOK: query: insert into datetest values('2001-03-22', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__2
+POSTHOOK: Output: default@datetest
+POSTHOOK: Lineage: datetest.dvalue EXPRESSION [(values__tmp__table__2)values__tmp__table__2.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+POSTHOOK: Lineage: datetest.ivalue EXPRESSION [(values__tmp__table__2)values__tmp__table__2.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+PREHOOK: query: insert into datetest values('2002-03-22', 3)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__3
+PREHOOK: Output: default@datetest
+POSTHOOK: query: insert into datetest values('2002-03-22', 3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__3
+POSTHOOK: Output: default@datetest
+POSTHOOK: Lineage: datetest.dvalue EXPRESSION [(values__tmp__table__3)values__tmp__table__3.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+POSTHOOK: Lineage: datetest.ivalue EXPRESSION [(values__tmp__table__3)values__tmp__table__3.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+PREHOOK: query: insert into datetest values('2003-03-22', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__4
+PREHOOK: Output: default@datetest
+POSTHOOK: query: insert into datetest values('2003-03-22', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__4
+POSTHOOK: Output: default@datetest
+POSTHOOK: Lineage: datetest.dvalue EXPRESSION [(values__tmp__table__4)values__tmp__table__4.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+POSTHOOK: Lineage: datetest.ivalue EXPRESSION [(values__tmp__table__4)values__tmp__table__4.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+PREHOOK: query: SELECT * FROM datetest WHERE dValue IN ('2000-03-22','2001-03-22')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@datetest
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM datetest WHERE dValue IN ('2000-03-22','2001-03-22')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@datetest
+#### A masked pattern was here ####
+2000-03-22	1
+2001-03-22	2
+PREHOOK: query: drop table datetest
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@datetest
+PREHOOK: Output: default@datetest
+POSTHOOK: query: drop table datetest
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@datetest
+POSTHOOK: Output: default@datetest


Mime
View raw message