private boolean findIndexColumnExprNodeDesc(ExprNodeDesc expression) { if (expression.getChildren() == null) { return false; } if (expression.getChildren().size() == 2) { ExprNodeColumnDesc columnDesc = null; if (expression.getChildren().get(0) instanceof ExprNodeColumnDesc) { columnDesc = (ExprNodeColumnDesc)expression.getChildren().get(0); } else if (expression.getChildren().get(1) instanceof ExprNodeColumnDesc) { columnDesc = (ExprNodeColumnDesc)expression.getChildren().get(1); } // Is this the target if (columnDesc != null && !partitionCols.contains(columnDesc.getColumn())) { assert expression instanceof ExprNodeGenericFuncDesc : "Expression containing index column is does not support sorting, should not try" + "and sort"; ((ExprNodeGenericFuncDesc)expression).setSortedExpr(true); return true; } } for (ExprNodeDesc child : expression.getChildren()) { // If the target has been found, no need to continue if (findIndexColumnExprNodeDesc(child)) { return true; } } return false; }
private boolean findIndexColumnExprNodeDesc(ExprNodeDesc expression) { if (expression.getChildren() == null) { return false; } if (expression.getChildren().size() == 2) { ExprNodeColumnDesc columnDesc = null; if (expression.getChildren().get(0) instanceof ExprNodeColumnDesc) { columnDesc = (ExprNodeColumnDesc)expression.getChildren().get(0); } else if (expression.getChildren().get(1) instanceof ExprNodeColumnDesc) { columnDesc = (ExprNodeColumnDesc)expression.getChildren().get(1); } // Is this the target if (columnDesc != null && !partitionCols.contains(columnDesc.getColumn())) { assert expression instanceof ExprNodeGenericFuncDesc : "Expression containing index column is does not support sorting, should not try" + "and sort"; ((ExprNodeGenericFuncDesc)expression).setSortedExpr(true); return true; } } for (ExprNodeDesc child : expression.getChildren()) { // If the target has been found, no need to continue if (findIndexColumnExprNodeDesc(child)) { return true; } } return false; }