Repository: hive
Updated Branches:
  refs/heads/branch-1 743585890 -> 52d16df58


HIVE-12022: NPE in SARG with timestamp cast (Prasanth Jayachandran reviewed by 
Sergey Shelukhin)


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

Branch: refs/heads/branch-1
Commit: 52d16df58d36b6de83a621aaa4d5a63fbb73eb98
Parents: 7435858
Author: Prasanth Jayachandran <j.prasant...@gmail.com>
Authored: Wed Jan 20 17:20:44 2016 -0600
Committer: Prasanth Jayachandran <j.prasant...@gmail.com>
Committed: Wed Jan 20 17:20:44 2016 -0600

----------------------------------------------------------------------
 .../hive/ql/io/sarg/SearchArgumentImpl.java       |  2 +-
 .../queries/clientpositive/orc_ppd_timestamp.q    |  6 ++++++
 .../clientpositive/orc_ppd_timestamp.q.out        | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/52d16df5/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java 
b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
index a71fb81..e692ec5 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
@@ -145,7 +145,7 @@ final class SearchArgumentImpl implements SearchArgument {
       } else if (literalList != null) {
         for(Object lit: literalList) {
           buffer.append(' ');
-          buffer.append(lit.toString());
+          buffer.append(lit);
         }
       }
       buffer.append(')');

http://git-wip-us.apache.org/repos/asf/hive/blob/52d16df5/ql/src/test/queries/clientpositive/orc_ppd_timestamp.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/orc_ppd_timestamp.q 
b/ql/src/test/queries/clientpositive/orc_ppd_timestamp.q
index dafd6cf..90fba62 100644
--- a/ql/src/test/queries/clientpositive/orc_ppd_timestamp.q
+++ b/ql/src/test/queries/clientpositive/orc_ppd_timestamp.q
@@ -95,3 +95,9 @@ select sum(hash(*)) from newtypesorc where ts between 
cast('2010-10-01 01:01:01'
 
 set hive.optimize.index.filter=true;
 select sum(hash(*)) from newtypesorc where ts between cast('2010-10-01 
01:01:01' as timestamp) and cast('2010-11-01 01:01:01' as timestamp);
+
+set hive.optimize.index.filter=false;
+select sum(hash(*)) from newtypesorc where ts between cast('2010-10-01' as 
timestamp) and cast('2010-11-01' as timestamp);
+
+set hive.optimize.index.filter=true;
+select sum(hash(*)) from newtypesorc where ts between cast('2010-10-01' as 
timestamp) and cast('2010-11-01' as timestamp);

http://git-wip-us.apache.org/repos/asf/hive/blob/52d16df5/ql/src/test/results/clientpositive/orc_ppd_timestamp.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/orc_ppd_timestamp.q.out 
b/ql/src/test/results/clientpositive/orc_ppd_timestamp.q.out
index f1030a9..ea5c85b 100644
--- a/ql/src/test/results/clientpositive/orc_ppd_timestamp.q.out
+++ b/ql/src/test/results/clientpositive/orc_ppd_timestamp.q.out
@@ -290,3 +290,21 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@newtypesorc
 #### A masked pattern was here ####
 NULL
+PREHOOK: query: select sum(hash(*)) from newtypesorc where ts between 
cast('2010-10-01' as timestamp) and cast('2010-11-01' as timestamp)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where ts between 
cast('2010-10-01' as timestamp) and cast('2010-11-01' as timestamp)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: select sum(hash(*)) from newtypesorc where ts between 
cast('2010-10-01' as timestamp) and cast('2010-11-01' as timestamp)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where ts between 
cast('2010-10-01' as timestamp) and cast('2010-11-01' as timestamp)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+NULL

Reply via email to