@Override public Pair<RexNode, String> get(int index) { if (index < leftCount) { RelDataTypeField field = fields.get(index); return Pair.<RexNode, String>of( new RexInputRef(index, field.getType()), field.getName()); } else { return Pair.<RexNode, String>of( extraLeftExprs.get(index - leftCount), null); } } },
private RelNode convertCursor(Blackboard bb, SubQuery subQuery) { final SqlCall cursorCall = (SqlCall) subQuery.node; assert cursorCall.operandCount() == 1; SqlNode query = cursorCall.operand(0); RelNode converted = convertQuery(query, false, false); int iCursor = bb.cursors.size(); bb.cursors.add(converted); subQuery.expr = new RexInputRef( iCursor, converted.getRowType()); return converted; }
@Override public Pair<RexNode, String> get(int index) { if (index < rightCount) { RelDataTypeField field = fields.get(index); return Pair.<RexNode, String>of( new RexInputRef(index, field.getType()), field.getName()); } else { return Pair.of( RexUtil.shift( extraRightExprs.get(index - rightCount), -newLeftCount), null); } } },
fix(extraRightExprs, mid, mid + 1); extraLeftExprs.add(node); return new RexInputRef(mid, node.getType()); case RIGHT: final int index2 = mid + rightCount + extraRightExprs.size(); extraRightExprs.add(node); return new RexInputRef(index2, node.getType()); case BOTH: case EMPTY:
undoProjects.add( Pair.of( (RexNode) new RexInputRef( squished.get(origin), field.getType()), field.getName()));
private RexNode registerField(String fieldName, RelDataType type) { RexInputRef x = map.get(fieldName); if (x == null) { x = new RexInputRef(map.size(), type); map.put(fieldName, x); builder.add(fieldName, type); items.add(fieldName + ": 1"); } return x; } }
/** * Creates a reference to a given field in a list of fields. */ public static RexInputRef of(int index, List<RelDataTypeField> fields) { return new RexInputRef(index, fields.get(index).getType()); }
@Override public RexNode visitInputRef(RexInputRef ref) { final Integer integer = map.get(ref.getName()); if (integer != null) { return new RexInputRef(integer, ref.getType()); } throw MatchFailed.INSTANCE; }
public RexNode get(int index) { final RexNode operand = operands.get(index); assert operand instanceof RexLocalRef; final RexLocalRef ref = (RexLocalRef) operand; return new RexInputRef(ref.getIndex(), ref.getType()); } };
@Override public RexNode visitInputRef(RexInputRef input) { final int index = input.getIndex(); if (index < start) { return input; } return new RexInputRef(index + offset, input.getType()); } });
@Override public RexNode visitLocalRef(RexLocalRef localRef) { return new RexInputRef(localRef.getIndex(), localRef.getType()); } };
@Override public RexNode visitInputRef(RexInputRef input) { return new RexInputRef(input.getIndex() + offset, input.getType()); } });
private RelNode convertCursor(Blackboard bb, SqlCall cursorCall) { assert cursorCall.operandCount() == 1; SqlNode query = cursorCall.operand(0); RelNode converted = convertQuery(query, false, false); int iCursor = bb.cursors.size(); bb.cursors.add(converted); RexNode expr = new RexInputRef( iCursor, converted.getRowType()); bb.mapSubqueryToExpr.put(cursorCall, expr); return converted; }
/** * Creates a reference to a given field in a list of fields. */ public static Pair<RexNode, String> of2( int index, List<RelDataTypeField> fields) { final RelDataTypeField field = fields.get(index); return Pair.of( (RexNode) new RexInputRef(index, field.getType()), field.getName()); }
public RexNode get(int index) { final RexLocalRef ref = program.getProjectList().get(index); return new RexInputRef(ref.getIndex(), ref.getType()); }
public List<RexNode> rexArguments() { List<RelDataTypeField> inputTypes = inputPhysType.getRowType().getFieldList(); List<RexNode> args = new ArrayList<RexNode>(); for (Integer index : agg.call.getArgList()) { args.add(new RexInputRef(index, inputTypes.get(index).getType())); } return args; }
@Override public RexNode visitCall(RexCall call) { final Integer integer = map.get(call.toString()); if (integer != null) { return new RexInputRef(integer, call.getType()); } return super.visitCall(call); } };
@Override public RexNode visitInputRef(RexInputRef local) { final int index = local.getIndex(); int target = mapping.getTarget(index); return new RexInputRef( target, local.getType()); }
public RexNode visitInputRef(RexInputRef input) { final int oldIndex = input.getIndex(); final int newIndex = getNewForOldInput(oldIndex); // FIXME: jhyde, 2005/12/3: Once indicator fields have been // introduced, the new field type may be very different to the // old field type. We should look at the actual flattened types, // rather than trying to deduce the type from the current type. RelDataType fieldType = removeDistinct(input.getType()); RexInputRef newInput = new RexInputRef(newIndex, fieldType); return newInput; }
public RexNode visitInputRef(RexInputRef input) { final int oldIndex = input.getIndex(); final int newIndex = getNewForOldInput(oldIndex); // FIXME: jhyde, 2005/12/3: Once indicator fields have been // introduced, the new field type may be very different to the // old field type. We should look at the actual flattened types, // rather than trying to deduce the type from the current type. RelDataType fieldType = removeDistinct(input.getType()); RexInputRef newInput = new RexInputRef(newIndex, fieldType); return newInput; }