You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2014/10/08 04:38:25 UTC
svn commit: r1630001 - in /hive/branches/branch-0.14/ql/src:
java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java
test/queries/clientpositive/sum_expr_with_order.q
test/results/clientpositive/sum_expr_with_order.q.out
Author: jdere
Date: Wed Oct 8 02:38:24 2014
New Revision: 1630001
URL: http://svn.apache.org/r1630001
Log:
HIVE-8272: Query with particular decimal expression causes NPE during execution initialization (Jason Dere, reviewed by Ashutosh Chauhan)
Added:
hive/branches/branch-0.14/ql/src/test/queries/clientpositive/sum_expr_with_order.q
hive/branches/branch-0.14/ql/src/test/results/clientpositive/sum_expr_with_order.q.out
Modified:
hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java
Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java?rev=1630001&r1=1630000&r2=1630001&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java (original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java Wed Oct 8 02:38:24 2014
@@ -212,7 +212,14 @@ public class ExprNodeDescUtils {
if (source instanceof ExprNodeGenericFuncDesc) {
// all children expression should be resolved
ExprNodeGenericFuncDesc function = (ExprNodeGenericFuncDesc) source.clone();
- function.setChildren(backtrack(function.getChildren(), current, terminal));
+ List<ExprNodeDesc> children = backtrack(function.getChildren(), current, terminal);
+ for (ExprNodeDesc child : children) {
+ if (child == null) {
+ // Could not resolve all of the function children, fail
+ return null;
+ }
+ }
+ function.setChildren(children);
return function;
}
if (source instanceof ExprNodeColumnDesc) {
@@ -222,7 +229,11 @@ public class ExprNodeDescUtils {
if (source instanceof ExprNodeFieldDesc) {
// field expression should be resolved
ExprNodeFieldDesc field = (ExprNodeFieldDesc) source.clone();
- field.setDesc(backtrack(field.getDesc(), current, terminal));
+ ExprNodeDesc fieldDesc = backtrack(field.getDesc(), current, terminal);
+ if (fieldDesc == null) {
+ return null;
+ }
+ field.setDesc(fieldDesc);
return field;
}
// constant or null expr, just return
Added: hive/branches/branch-0.14/ql/src/test/queries/clientpositive/sum_expr_with_order.q
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/queries/clientpositive/sum_expr_with_order.q?rev=1630001&view=auto
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/queries/clientpositive/sum_expr_with_order.q (added)
+++ hive/branches/branch-0.14/ql/src/test/queries/clientpositive/sum_expr_with_order.q Wed Oct 8 02:38:24 2014
@@ -0,0 +1,5 @@
+
+select
+cast(sum(key)*100 as decimal(15,3)) as c1
+from src
+order by c1;
Added: hive/branches/branch-0.14/ql/src/test/results/clientpositive/sum_expr_with_order.q.out
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/clientpositive/sum_expr_with_order.q.out?rev=1630001&view=auto
==============================================================================
--- hive/branches/branch-0.14/ql/src/test/results/clientpositive/sum_expr_with_order.q.out (added)
+++ hive/branches/branch-0.14/ql/src/test/results/clientpositive/sum_expr_with_order.q.out Wed Oct 8 02:38:24 2014
@@ -0,0 +1,15 @@
+PREHOOK: query: select
+cast(sum(key)*100 as decimal(15,3)) as c1
+from src
+order by c1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+cast(sum(key)*100 as decimal(15,3)) as c1
+from src
+order by c1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+13009100