public Void visitLocalRef(RexLocalRef localRef) { final int index = localRef.getIndex(); refCounts[index]++; return null; } }
public RexNode visitLocalRef(RexLocalRef localRef) { final int index = localRef.getIndex(); if (index < inputFieldCount) { // Reference to input field. return localRef; } return new RexLocalRef( flattenedAggCallList.size() + index, localRef.getType()); } };
/** * Fully expands a RexLocalRef back into a pure RexNode tree containing no * RexLocalRefs (reversing the effect of common subexpression elimination). * For example, <code>program.expandLocalRef(program.getCondition())</code> * will return the expansion of a program's condition. * * @param ref a RexLocalRef from this program * @return expanded form */ public RexNode expandLocalRef(RexLocalRef ref) { // TODO jvs 19-Apr-2006: assert that ref is part of // this program ExpansionShuttle shuttle = new ExpansionShuttle(); return ref.accept(shuttle); }
/** * Adds an expression to the list of common expressions, and returns a * reference to the expression. <b>DOES NOT CHECK WHETHER THE EXPRESSION * ALREADY EXISTS</b>. * * @param expr Expression * @return Reference to expression */ public RexLocalRef addExpr(RexNode expr) { RexLocalRef ref; final int index = exprList.size(); exprList.add(expr); ref = new RexLocalRef( index, expr.getType()); localRefList.add(ref); return ref; }
public RelDataType getFieldType(int index) { return projectRefs.get(index).getType(); } });
/** * Creates a local variable. * * @param index Index of the field in the underlying row type * @param type Type of the column */ public RexLocalRef(int index, RelDataType type) { super(createName(index), index, type); assert type != null; assert index >= 0; }
/** * Creates a copy of this program. */ public RexProgram copy() { return new RexProgram( inputRowType, exprs, projects, (condition == null) ? null : condition.clone(), outputRowType); }
/** * Adds an expression to the list of common expressions, and returns a * reference to the expression. <b>DOES NOT CHECK WHETHER THE EXPRESSION * ALREADY EXISTS</b>. * * @param expr Expression * * @return Reference to expression */ public RexLocalRef addExpr(RexNode expr) { RexLocalRef ref; final int index = exprList.size(); exprList.add(expr); ref = new RexLocalRef( index, expr.getType()); localRefList.add(ref); return ref; }
public RelDataType getFieldType(int index) { return projectRefList.get(index).getType(); } });
/** * Creates a local variable. * * @param index Index of the field in the underlying rowtype * @param type Type of the column * * @pre type != null * @pre index >= 0 */ public RexLocalRef( int index, RelDataType type) { super( createName(index), index, type); }
public Void visitLocalRef(RexLocalRef localRef) { final int index = localRef.getIndex(); refCounts[index]++; return null; } }
public RexNode visitLocalRef(RexLocalRef localRef) { final int index = localRef.getIndex(); if (index < inputFieldCount) { // Reference to input field. return localRef; } return new RexLocalRef( flattenedAggCallList.size() + index, localRef.getType()); } };
/** * Creates a reference to a given input field. * * @param index Ordinal of input field, must be less than the number of * fields in the input type * @return Reference to input field */ public RexLocalRef makeInputRef(int index) { final List<RelDataTypeField> fields = inputRowType.getFieldList(); assert index < fields.size(); final RelDataTypeField field = fields.get(index); return new RexLocalRef( index, field.getType()); }
public RexNode visitInputRef(RexInputRef input) { // This expression refers to the Nth project column. Lookup that // column and find out what common sub-expression IT refers to. final int index = input.getIndex(); final RexLocalRef local = projectRefList.get(index); assert RelOptUtil.eq( "type1", local.getType(), "type2", input.getType(), true); return local; }
/** * Fully expands a RexLocalRef back into a pure RexNode tree containing no * RexLocalRefs (reversing the effect of common subexpression elimination). * For example, <code>program.expandLocalRef(program.getCondition())</code> * will return the expansion of a program's condition. * * @param ref a RexLocalRef from this program * * @return expanded form */ public RexNode expandLocalRef(RexLocalRef ref) { // TODO jvs 19-Apr-2006: assert that ref is part of // this program ExpansionShuttle shuttle = new ExpansionShuttle(); return ref.accept(shuttle); }