You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by rh...@apache.org on 2014/10/13 19:50:06 UTC
svn commit: r1631483 - in /hive/trunk/ql/src:
java/org/apache/hadoop/hive/ql/exec/ test/queries/clientpositive/
test/results/clientpositive/
Author: rhbutani
Date: Mon Oct 13 17:50:05 2014
New Revision: 1631483
URL: http://svn.apache.org/r1631483
Log:
HIVE-8361 NPE in PTFOperator when there are empty partitions (Harish Butani via Gunther Hagleitner)
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PTFOperator.java
hive/trunk/ql/src/test/queries/clientpositive/ptf_matchpath.q
hive/trunk/ql/src/test/queries/clientpositive/windowing.q
hive/trunk/ql/src/test/results/clientpositive/ptf_matchpath.q.out
hive/trunk/ql/src/test/results/clientpositive/windowing.q.out
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PTFOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PTFOperator.java?rev=1631483&r1=1631482&r2=1631483&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PTFOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PTFOperator.java Mon Oct 13 17:50:05 2014
@@ -337,17 +337,20 @@ public class PTFOperator extends Operato
handleOutputRows(tabFn.finishPartition());
} else {
if ( tabFn.canIterateOutput() ) {
- outputPartRowsItr = tabFn.iterator(inputPart.iterator());
+ outputPartRowsItr = inputPart == null ? null :
+ tabFn.iterator(inputPart.iterator());
} else {
- outputPart = tabFn.execute(inputPart);
- outputPartRowsItr = outputPart.iterator();
+ outputPart = inputPart == null ? null : tabFn.execute(inputPart);
+ outputPartRowsItr = outputPart == null ? null : outputPart.iterator();
}
if ( next != null ) {
if (!next.isStreaming() && !isOutputIterator() ) {
next.inputPart = outputPart;
} else {
- while(outputPartRowsItr.hasNext() ) {
- next.processRow(outputPartRowsItr.next());
+ if ( outputPartRowsItr != null ) {
+ while(outputPartRowsItr.hasNext() ) {
+ next.processRow(outputPartRowsItr.next());
+ }
}
}
}
@@ -357,8 +360,10 @@ public class PTFOperator extends Operato
next.finishPartition();
} else {
if (!isStreaming() ) {
- while(outputPartRowsItr.hasNext() ) {
- forward(outputPartRowsItr.next(), outputObjInspector);
+ if ( outputPartRowsItr != null ) {
+ while(outputPartRowsItr.hasNext() ) {
+ forward(outputPartRowsItr.next(), outputObjInspector);
+ }
}
}
}
Modified: hive/trunk/ql/src/test/queries/clientpositive/ptf_matchpath.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/ptf_matchpath.q?rev=1631483&r1=1631482&r2=1631483&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/ptf_matchpath.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/ptf_matchpath.q Mon Oct 13 17:50:05 2014
@@ -32,5 +32,15 @@ from matchpath(on
arg2('LATE'), arg3(arr_delay > 15),
arg4('origin_city_name, fl_num, year, month, day_of_month, size(tpath) as sz, tpath[0].day_of_month as tpath')
)
-where fl_num = 1142;
+where fl_num = 1142;
+
+-- 3. empty partition.
+select origin_city_name, fl_num, year, month, day_of_month, sz, tpath
+from matchpath(on
+ (select * from flights_tiny where fl_num = -1142) flights_tiny
+ sort by fl_num, year, month, day_of_month
+ arg1('LATE.LATE+'),
+ arg2('LATE'), arg3(arr_delay > 15),
+ arg4('origin_city_name, fl_num, year, month, day_of_month, size(tpath) as sz, tpath[0].day_of_month as tpath')
+ );
\ No newline at end of file
Modified: hive/trunk/ql/src/test/queries/clientpositive/windowing.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/windowing.q?rev=1631483&r1=1631482&r2=1631483&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/windowing.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/windowing.q Mon Oct 13 17:50:05 2014
@@ -444,3 +444,7 @@ select p_retailprice, avg(p_retailprice)
sum(p_retailprice) over (partition by p_mfgr order by p_name rows between current row and 6 following)
from part
where p_mfgr='Manufacturer#1';
+
+-- 47. empty partition
+select sum(p_size) over (partition by p_mfgr )
+from part where p_mfgr = 'm1';
Modified: hive/trunk/ql/src/test/results/clientpositive/ptf_matchpath.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/ptf_matchpath.q.out?rev=1631483&r1=1631482&r2=1631483&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/ptf_matchpath.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/ptf_matchpath.q.out Mon Oct 13 17:50:05 2014
@@ -107,3 +107,27 @@ Baltimore 1142 2010 10 21 5 21
Baltimore 1142 2010 10 22 4 22
Baltimore 1142 2010 10 25 3 25
Baltimore 1142 2010 10 26 2 26
+PREHOOK: query: -- 3. empty partition.
+select origin_city_name, fl_num, year, month, day_of_month, sz, tpath
+from matchpath(on
+ (select * from flights_tiny where fl_num = -1142) flights_tiny
+ sort by fl_num, year, month, day_of_month
+ arg1('LATE.LATE+'),
+ arg2('LATE'), arg3(arr_delay > 15),
+ arg4('origin_city_name, fl_num, year, month, day_of_month, size(tpath) as sz, tpath[0].day_of_month as tpath')
+ )
+PREHOOK: type: QUERY
+PREHOOK: Input: default@flights_tiny
+#### A masked pattern was here ####
+POSTHOOK: query: -- 3. empty partition.
+select origin_city_name, fl_num, year, month, day_of_month, sz, tpath
+from matchpath(on
+ (select * from flights_tiny where fl_num = -1142) flights_tiny
+ sort by fl_num, year, month, day_of_month
+ arg1('LATE.LATE+'),
+ arg2('LATE'), arg3(arr_delay > 15),
+ arg4('origin_city_name, fl_num, year, month, day_of_month, size(tpath) as sz, tpath[0].day_of_month as tpath')
+ )
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@flights_tiny
+#### A masked pattern was here ####
Modified: hive/trunk/ql/src/test/results/clientpositive/windowing.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/windowing.q.out?rev=1631483&r1=1631482&r2=1631483&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/windowing.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/windowing.q.out Mon Oct 13 17:50:05 2014
@@ -2362,3 +2362,15 @@ POSTHOOK: Input: default@part
1602.59 1549.8900000000003 4649.670000000001
1414.42 1523.5400000000004 3047.080000000001
1632.66 1632.6600000000008 1632.6600000000008
+PREHOOK: query: -- 47. empty partition
+select sum(p_size) over (partition by p_mfgr )
+from part where p_mfgr = 'm1'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+#### A masked pattern was here ####
+POSTHOOK: query: -- 47. empty partition
+select sum(p_size) over (partition by p_mfgr )
+from part where p_mfgr = 'm1'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+#### A masked pattern was here ####