FAQ
Author: namit
Date: Tue Dec 18 06:22:51 2012
New Revision: 1423285

URL: http://svn.apache.org/viewvc?rev=1423285&view=rev
Log:
HIVE-3795 NPE in SELECT when WHERE-clause is an and/or/not operation involving null
(Xiao Jiang via namit)


Added:
hive/trunk/ql/src/test/queries/clientpositive/select_unquote_and.q
hive/trunk/ql/src/test/queries/clientpositive/select_unquote_not.q
hive/trunk/ql/src/test/queries/clientpositive/select_unquote_or.q
hive/trunk/ql/src/test/results/clientpositive/select_unquote_and.q.out
hive/trunk/ql/src/test/results/clientpositive/select_unquote_not.q.out
hive/trunk/ql/src/test/results/clientpositive/select_unquote_or.q.out
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java?rev=1423285&r1=1423284&r2=1423285&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java Tue Dec 18 06:22:51 2012
@@ -125,7 +125,9 @@ public final class PcrExprProcFactory {
}

static Boolean opAnd(Boolean op1, Boolean op2) {
- if (op1.equals(Boolean.FALSE) || op2.equals(Boolean.FALSE)) {
+ // When people forget to quote a string, op1/op2 is null.
+ // For example, select * from some_table where ds > 2012-12-1 and ds < 2012-12-2 .
+ if (op1 != null && op1.equals(Boolean.FALSE) || op2 != null && op2.equals(Boolean.FALSE)) {
return Boolean.FALSE;
}
if (op1 == null || op2 == null) {
@@ -135,7 +137,9 @@ public final class PcrExprProcFactory {
}

static Boolean opOr(Boolean op1, Boolean op2) {
- if (op1.equals(Boolean.TRUE) || op2.equals(Boolean.TRUE)) {
+ // When people forget to quote a string, op1/op2 is null.
+ // For example, select * from some_table where ds > 2012-12-1 or ds < 2012-12-2 .
+ if (op1 != null && op1.equals(Boolean.TRUE) || op2 != null && op2.equals(Boolean.TRUE)) {
return Boolean.TRUE;
}
if (op1 == null || op2 == null) {
@@ -145,11 +149,15 @@ public final class PcrExprProcFactory {
}

static Boolean opNot(Boolean op) {
- if (op.equals(Boolean.TRUE)) {
- return Boolean.FALSE;
- }
- if (op.equals(Boolean.FALSE)) {
- return Boolean.TRUE;
+ // When people forget to quote a string, op1/op2 is null.
+ // For example, select * from some_table where not ds > 2012-12-1 .
+ if (op != null) {
+ if (op.equals(Boolean.TRUE)) {
+ return Boolean.FALSE;
+ }
+ if (op.equals(Boolean.FALSE)) {
+ return Boolean.TRUE;
+ }
}
return null;
}

Added: hive/trunk/ql/src/test/queries/clientpositive/select_unquote_and.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/select_unquote_and.q?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/select_unquote_and.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/select_unquote_and.q Tue Dec 18 06:22:51 2012
@@ -0,0 +1,15 @@
+CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING);
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200';
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200';
+
+SELECT count(*) FROM npe_test;
+
+EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15;
+
+SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15;
+
+DROP TABLE npe_test;

Added: hive/trunk/ql/src/test/queries/clientpositive/select_unquote_not.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/select_unquote_not.q?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/select_unquote_not.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/select_unquote_not.q Tue Dec 18 06:22:51 2012
@@ -0,0 +1,15 @@
+CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING);
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200';
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200';
+
+SELECT count(*) FROM npe_test;
+
+EXPLAIN SELECT * FROM npe_test WHERE NOT ds < 2012-11-31;
+
+SELECT count(*) FROM npe_test WHERE NOT ds < 2012-11-31;
+
+DROP TABLE npe_test;

Added: hive/trunk/ql/src/test/queries/clientpositive/select_unquote_or.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/select_unquote_or.q?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/select_unquote_or.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/select_unquote_or.q Tue Dec 18 06:22:51 2012
@@ -0,0 +1,15 @@
+CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING);
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200';
+
+INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200';
+
+SELECT count(*) FROM npe_test;
+
+EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15;
+
+SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15;
+
+DROP TABLE npe_test;

Added: hive/trunk/ql/src/test/results/clientpositive/select_unquote_and.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/select_unquote_and.q.out?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/select_unquote_and.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/select_unquote_and.q.out Tue Dec 18 06:22:51 2012
@@ -0,0 +1,120 @@
+PREHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@npe_test
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: SELECT count(*) FROM npe_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+498
+PREHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15
+POSTHOOK: type: QUERY
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME npe_test))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (AND (> (TOK_TABLE_OR_COL ds) (- (- 2012 11) 31)) (< (TOK_TABLE_OR_COL ds) (- (- 2012 12) 15))))))
+
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Alias -> Map Operator Tree:
+ npe_test
+ TableScan
+ alias: npe_test
+ Filter Operator
+ predicate:
+ expr: ((ds > ((2012 - 11) - 31)) and (ds < ((2012 - 12) - 15)))
+ type: boolean
+ Select Operator
+ expressions:
+ expr: key
+ type: string
+ expr: value
+ type: string
+ expr: ds
+ type: string
+ outputColumnNames: _col0, _col1, _col2
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+
+
+PREHOOK: query: SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 AND ds < 2012-12-15
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+0
+PREHOOK: query: DROP TABLE npe_test
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@npe_test
+PREHOOK: Output: default@npe_test
+POSTHOOK: query: DROP TABLE npe_test
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@npe_test
+POSTHOOK: Output: default@npe_test
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]

Added: hive/trunk/ql/src/test/results/clientpositive/select_unquote_not.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/select_unquote_not.q.out?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/select_unquote_not.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/select_unquote_not.q.out Tue Dec 18 06:22:51 2012
@@ -0,0 +1,120 @@
+PREHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@npe_test
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: SELECT count(*) FROM npe_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+498
+PREHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE NOT ds < 2012-11-31
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE NOT ds < 2012-11-31
+POSTHOOK: type: QUERY
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME npe_test))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (NOT (< (TOK_TABLE_OR_COL ds) (- (- 2012 11) 31))))))
+
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Alias -> Map Operator Tree:
+ npe_test
+ TableScan
+ alias: npe_test
+ Filter Operator
+ predicate:
+ expr: (not (ds < ((2012 - 11) - 31)))
+ type: boolean
+ Select Operator
+ expressions:
+ expr: key
+ type: string
+ expr: value
+ type: string
+ expr: ds
+ type: string
+ outputColumnNames: _col0, _col1, _col2
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+
+
+PREHOOK: query: SELECT count(*) FROM npe_test WHERE NOT ds < 2012-11-31
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test WHERE NOT ds < 2012-11-31
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+0
+PREHOOK: query: DROP TABLE npe_test
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@npe_test
+PREHOOK: Output: default@npe_test
+POSTHOOK: query: DROP TABLE npe_test
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@npe_test
+POSTHOOK: Output: default@npe_test
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]

Added: hive/trunk/ql/src/test/results/clientpositive/select_unquote_or.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/select_unquote_or.q.out?rev=1423285&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/select_unquote_or.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/select_unquote_or.q.out Tue Dec 18 06:22:51 2012
@@ -0,0 +1,120 @@
+PREHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: CREATE TABLE npe_test (key STRING, value STRING) PARTITIONED BY (ds STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@npe_test
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-11')
+SELECT src.key, src.value FROM src WHERE key < '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-11
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+PREHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: query: INSERT OVERWRITE TABLE npe_test PARTITION(ds='2012-12-12')
+SELECT src.key, src.value FROM src WHERE key > '200'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@npe_test@ds=2012-12-12
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+PREHOOK: query: SELECT count(*) FROM npe_test
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+498
+PREHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN SELECT * FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15
+POSTHOOK: type: QUERY
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME npe_test))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (OR (> (TOK_TABLE_OR_COL ds) (- (- 2012 11) 31)) (< (TOK_TABLE_OR_COL ds) (- (- 2012 12) 15))))))
+
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Alias -> Map Operator Tree:
+ npe_test
+ TableScan
+ alias: npe_test
+ Filter Operator
+ predicate:
+ expr: ((ds > ((2012 - 11) - 31)) or (ds < ((2012 - 12) - 15)))
+ type: boolean
+ Select Operator
+ expressions:
+ expr: key
+ type: string
+ expr: value
+ type: string
+ expr: ds
+ type: string
+ outputColumnNames: _col0, _col1, _col2
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+
+
+PREHOOK: query: SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15
+PREHOOK: type: QUERY
+PREHOOK: Input: default@npe_test@ds=2012-12-11
+PREHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT count(*) FROM npe_test WHERE ds > 2012-11-31 OR ds < 2012-12-15
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@npe_test@ds=2012-12-11
+POSTHOOK: Input: default@npe_test@ds=2012-12-12
+#### A masked pattern was here ####
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+0
+PREHOOK: query: DROP TABLE npe_test
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@npe_test
+PREHOOK: Output: default@npe_test
+POSTHOOK: query: DROP TABLE npe_test
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@npe_test
+POSTHOOK: Output: default@npe_test
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-11).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
+POSTHOOK: Lineage: npe_test PARTITION(ds=2012-12-12).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedDec 18, '12 at 6:23a
activeDec 18, '12 at 6:23a
posts1
users1
websitehive.apache.org

1 user in discussion

Namit: 1 post

People

Translate

site design / logo © 2021 Grokbase