/** * Converts a list of expressions that are based on the output fields of a * {@link Project} to equivalent expressions on the Project's * input fields. * * @param nodes The expressions to be converted * @param project Project underneath the expression * @return converted expressions */ public static List<RexNode> pushPastProject(List<? extends RexNode> nodes, Project project) { final List<RexNode> list = new ArrayList<>(); pushShuttle(project).visitList(nodes, list); return list; }
/** * Converts a list of expressions that are based on the output fields of a * {@link Project} to equivalent expressions on the Project's * input fields. * * @param nodes The expressions to be converted * @param project Project underneath the expression * @return converted expressions */ public static List<RexNode> pushPastProject(List<? extends RexNode> nodes, Project project) { final List<RexNode> list = new ArrayList<>(); pushShuttle(project).visitList(nodes, list); return list; }
public RexNode visitSubQuery(RexSubQuery subQuery) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(subQuery.operands, update); if (update[0]) { return subQuery.clone(subQuery.getType(), clonedOperands); } else { return subQuery; } }
public RexNode visitSubQuery(RexSubQuery subQuery) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(subQuery.operands, update); if (update[0]) { return subQuery.clone(subQuery.getType(), clonedOperands); } else { return subQuery; } }
public RexNode visitCall(final RexCall call) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(call.operands, update); if (update[0]) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return call.clone(call.getType(), clonedOperands); } else { return call; } }
return super.visitList(exprs, update); default: if (timeUnit != TimeUnitRange.YEAR) {
return super.visitList(exprs, update); default: if (timeUnit != TimeUnitRange.YEAR) {
public RexNode visitCall(final RexCall call) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(call.operands, update); if (update[0]) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return new RexCall( call.getType(), call.getOperator(), clonedOperands); } else { return call; } }
public RexNode visitOver(RexOver over) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(over.operands, update); RexWindow window = visitWindow(over.getWindow()); if (update[0] || (window != over.getWindow())) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return new RexOver( over.getType(), over.getAggOperator(), clonedOperands, window, over.isDistinct()); } else { return over; } }
public RexNode visitOver(RexOver over) { boolean[] update = {false}; List<RexNode> clonedOperands = visitList(over.operands, update); RexWindow window = visitWindow(over.getWindow()); if (update[0] || (window != over.getWindow())) { // REVIEW jvs 8-Mar-2005: This doesn't take into account // the fact that a rewrite may have changed the result type. // To do that, we would need to take a RexBuilder and // watch out for special operators like CAST and NEW where // the type is embedded in the original call. return new RexOver( over.getType(), over.getAggOperator(), clonedOperands, window, over.isDistinct()); } else { return over; } }
public RexWindow visitWindow(RexWindow window) { boolean[] update = {false}; List<RexFieldCollation> clonedOrderKeys = visitFieldCollations(window.orderKeys, update); List<RexNode> clonedPartitionKeys = visitList(window.partitionKeys, update); RexWindowBound lowerBound = window.getLowerBound().accept(this); RexWindowBound upperBound = window.getUpperBound().accept(this); if (update[0] || (lowerBound != window.getLowerBound() && lowerBound != null) || (upperBound != window.getUpperBound() && upperBound != null)) { return new RexWindow( clonedPartitionKeys, clonedOrderKeys, lowerBound, upperBound, window.isRows()); } else { return window; } }
public RexWindow visitWindow(RexWindow window) { boolean[] update = {false}; List<RexFieldCollation> clonedOrderKeys = visitFieldCollations(window.orderKeys, update); List<RexNode> clonedPartitionKeys = visitList(window.partitionKeys, update); RexWindowBound lowerBound = window.getLowerBound().accept(this); RexWindowBound upperBound = window.getUpperBound().accept(this); if (update[0] || (lowerBound != window.getLowerBound() && lowerBound != null) || (upperBound != window.getUpperBound() && upperBound != null)) { return new RexWindow( clonedPartitionKeys, clonedOrderKeys, lowerBound, upperBound, window.isRows()); } else { return window; } }