diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java index 746d0dc55e..2d611fb22a 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java @@ -78,13 +78,7 @@ public Tree dupNode() { if (super.getChildCount() == 0) { return null; } - - ArrayList ret_vec = new ArrayList(); - for (int i = 0; i < super.getChildCount(); ++i) { - ret_vec.add((Node) super.getChild(i)); - } - - return ret_vec; + return new ArrayList<>((List) super.getChildren()); } /* diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index f5df9cd302..95e01b22e6 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -14145,8 +14145,9 @@ void processPositionAlias(ASTNode ast) throws SemanticException { } } - for (int i = next.getChildren().size() - 1; i >= 0; i--) { - stack.push((ASTNode)next.getChildren().get(i)); + ArrayList childrenList = next.getChildren(); + for (int i = childrenList.size() - 1; i >= 0; i--) { + stack.push((ASTNode)childrenList.get(i)); } } } diff --git ql/src/java/org/apache/hadoop/hive/ql/ppd/ExprWalkerProcFactory.java ql/src/java/org/apache/hadoop/hive/ql/ppd/ExprWalkerProcFactory.java index f8b4ace257..550c796086 100644 --- ql/src/java/org/apache/hadoop/hive/ql/ppd/ExprWalkerProcFactory.java +++ ql/src/java/org/apache/hadoop/hive/ql/ppd/ExprWalkerProcFactory.java @@ -383,12 +383,11 @@ private static void extractFinalCandidates(ExprNodeDesc expr, // For the children, we populate the NewToOldExprMap to keep track of // the original condition before rewriting it for this operator assert ctx.getNewToOldExprMap().containsKey(expr); + List exprChildren = expr.getChildren(); + List newToOldList = ctx.getNewToOldExprMap().get(expr).getChildren(); for (int i = 0; i < expr.getChildren().size(); i++) { - ctx.getNewToOldExprMap().put( - expr.getChildren().get(i), - ctx.getNewToOldExprMap().get(expr).getChildren().get(i)); - extractFinalCandidates(expr.getChildren().get(i), - ctx, conf); + ctx.getNewToOldExprMap().put(exprChildren.get(i), newToOldList.get(i)); + extractFinalCandidates(exprChildren.get(i), ctx, conf); } return; }