You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pr...@apache.org on 2015/09/17 06:06:37 UTC
hive git commit: HIVE-11836: ORC SARG creation throws NPE for null
constants with void type (Prasanth Jayachandran reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/branch-1 3e73b1e68 -> 8527d2405
HIVE-11836: ORC SARG creation throws NPE for null constants with void type (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/8527d240
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8527d240
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8527d240
Branch: refs/heads/branch-1
Commit: 8527d24051d54b8be743f35c1a0dafc48299b482
Parents: 3e73b1e
Author: Prasanth Jayachandran <j....@gmail.com>
Authored: Wed Sep 16 23:06:20 2015 -0500
Committer: Prasanth Jayachandran <j....@gmail.com>
Committed: Wed Sep 16 23:06:20 2015 -0500
----------------------------------------------------------------------
.../hive/ql/io/sarg/SearchArgumentImpl.java | 4 +++
.../test/queries/clientpositive/orc_ppd_date.q | 13 +++++++
.../results/clientpositive/orc_ppd_date.q.out | 36 ++++++++++++++++++++
3 files changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/8527d240/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 7bce5a8..a71fb81 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
@@ -444,6 +444,10 @@ final class SearchArgumentImpl implements SearchArgument {
}
private static Object boxLiteral(ExprNodeConstantDesc lit) {
+ Object val = lit.getValue();
+ if (val == null) {
+ return null;
+ }
switch (getType(lit)) {
case INTEGER:
return ((Number) lit.getValue()).intValue();
http://git-wip-us.apache.org/repos/asf/hive/blob/8527d240/ql/src/test/queries/clientpositive/orc_ppd_date.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/orc_ppd_date.q b/ql/src/test/queries/clientpositive/orc_ppd_date.q
index 3d21d41..3606854 100644
--- a/ql/src/test/queries/clientpositive/orc_ppd_date.q
+++ b/ql/src/test/queries/clientpositive/orc_ppd_date.q
@@ -1,6 +1,7 @@
SET hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
SET mapred.min.split.size=1000;
SET mapred.max.split.size=5000;
+SET hive.cbo.enable=false;
create table newtypesorc(c char(10), v varchar(10), d decimal(5,3), da date) stored as orc tblproperties("orc.stripe.size"="16777216");
@@ -9,6 +10,18 @@ insert overwrite table newtypesorc select * from (select cast("apple" as char(10
-- date data types (EQUAL, NOT_EQUAL, LESS_THAN, LESS_THAN_EQUALS, IN, BETWEEN tests)
select sum(hash(*)) from newtypesorc where da='1970-02-20';
+set hive.optimize.index.filter=false;
+select sum(hash(*)) from newtypesorc where da is null or da = null;
+
+set hive.optimize.index.filter=true;
+select sum(hash(*)) from newtypesorc where da is null or da = null;
+
+set hive.optimize.index.filter=false;
+select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null;
+
+set hive.optimize.index.filter=true;
+select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null;
+
set hive.optimize.index.filter=true;
select sum(hash(*)) from newtypesorc where da='1970-02-20';
http://git-wip-us.apache.org/repos/asf/hive/blob/8527d240/ql/src/test/results/clientpositive/orc_ppd_date.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/orc_ppd_date.q.out b/ql/src/test/results/clientpositive/orc_ppd_date.q.out
index e07739d..da15a42 100644
--- a/ql/src/test/results/clientpositive/orc_ppd_date.q.out
+++ b/ql/src/test/results/clientpositive/orc_ppd_date.q.out
@@ -29,6 +29,42 @@ POSTHOOK: type: QUERY
POSTHOOK: Input: default@newtypesorc
#### A masked pattern was here ####
-252951929000
+PREHOOK: query: select sum(hash(*)) from newtypesorc where da is null or da = null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where da is null or da = null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: select sum(hash(*)) from newtypesorc where da is null or da = null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where da is null or da = null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+NULL
+PREHOOK: query: select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+81475875500
+PREHOOK: query: select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select sum(hash(*)) from newtypesorc where da is not null or da != null or da <> null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@newtypesorc
+#### A masked pattern was here ####
+81475875500
PREHOOK: query: select sum(hash(*)) from newtypesorc where da='1970-02-20'
PREHOOK: type: QUERY
PREHOOK: Input: default@newtypesorc