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..34e81cce61 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/ASTNode.java @@ -79,7 +79,7 @@ public Tree dupNode() { return null; } - ArrayList ret_vec = new ArrayList(); + ArrayList ret_vec = new ArrayList<>(super.getChildCount()); for (int i = 0; i < super.getChildCount(); ++i) { ret_vec.add((Node) super.getChild(i)); } 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 90549f9f3a..0445c50b74 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -14141,8 +14141,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; }