Java Code Examples for org.apache.calcite.rex.RexInputRef#getType()
The following examples show how to use
org.apache.calcite.rex.RexInputRef#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelDecorrelator.java From Bats with Apache License 2.0 | 6 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if (currentRel instanceof LogicalCorrelate) { // if this rel references corVar // and now it needs to be rewritten // it must have been pulled above the Correlate // replace the input ref to account for the LHS of the // Correlate final int leftInputFieldCount = ((LogicalCorrelate) currentRel).getLeft().getRowType().getFieldCount(); RelDataType newType = inputRef.getType(); if (projectPulledAboveLeftCorrelator) { newType = typeFactory.createTypeWithNullability(newType, true); } int pos = inputRef.getIndex(); RexInputRef newInputRef = RexBuilder.getRexFactory().makeInputRef(leftInputFieldCount + pos, newType); if ((isCount != null) && isCount.contains(pos)) { return createCaseExpression(newInputRef, rexBuilder.makeExactLiteral(BigDecimal.ZERO), newInputRef); } else { return newInputRef; } } return inputRef; }
Example 2
Source File: RewriteProjectToFlattenRule.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { // see if we have a reference to our child. if(inputRef instanceof MutableRexInputRef && refs.contains(inputRef)){ return inputRef; } if( !(inputRef instanceof MutableRexInputRef) ){ MutableRexInputRef previousPointer = refMap.get(inputRef.getIndex()); if(previousPointer != null){ return previousPointer; } } // create a new holder to add to the child of this. final MutableRexInputRef inputPointer = new MutableRexInputRef(inputRef.getType()); holders.add(new ProjectSlotHolder(inputRef, inputPointer)); if( !(inputRef instanceof MutableRexInputRef) ){ refMap.put(inputRef.getIndex(), inputPointer); } return inputPointer; }
Example 3
Source File: RelDecorrelator.java From Bats with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { final RexInputRef ref = getNewForOldInputRef(currentRel, map, inputRef); if (ref.getIndex() == inputRef.getIndex() && ref.getType() == inputRef.getType()) { return inputRef; // re-use old object, to prevent needless expr cloning } return ref; }
Example 4
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { final RexInputRef ref = getNewForOldInputRef(currentRel, map, inputRef); if (ref.getIndex() == inputRef.getIndex() && ref.getType() == inputRef.getType()) { return inputRef; // re-use old object, to prevent needless expr cloning } return ref; }
Example 5
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if (currentRel instanceof LogicalCorrelate) { // if this rel references corVar // and now it needs to be rewritten // it must have been pulled above the Correlate // replace the input ref to account for the LHS of the // Correlate final int leftInputFieldCount = ((LogicalCorrelate) currentRel).getLeft().getRowType() .getFieldCount(); RelDataType newType = inputRef.getType(); if (projectPulledAboveLeftCorrelator) { newType = typeFactory.createTypeWithNullability(newType, true); } int pos = inputRef.getIndex(); RexInputRef newInputRef = new RexInputRef(leftInputFieldCount + pos, newType); if ((isCount != null) && isCount.contains(pos)) { return createCaseExpression( newInputRef, rexBuilder.makeExactLiteral(BigDecimal.ZERO), newInputRef); } else { return newInputRef; } } return inputRef; }
Example 6
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { final RexInputRef ref = getNewForOldInputRef(currentRel, map, inputRef); if (ref.getIndex() == inputRef.getIndex() && ref.getType() == inputRef.getType()) { return inputRef; // re-use old object, to prevent needless expr cloning } return ref; }
Example 7
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if (currentRel instanceof LogicalCorrelate) { // if this rel references corVar // and now it needs to be rewritten // it must have been pulled above the Correlate // replace the input ref to account for the LHS of the // Correlate final int leftInputFieldCount = ((LogicalCorrelate) currentRel).getLeft().getRowType() .getFieldCount(); RelDataType newType = inputRef.getType(); if (projectPulledAboveLeftCorrelator) { newType = typeFactory.createTypeWithNullability(newType, true); } int pos = inputRef.getIndex(); RexInputRef newInputRef = new RexInputRef(leftInputFieldCount + pos, newType); if ((isCount != null) && isCount.contains(pos)) { return createCaseExpression( newInputRef, rexBuilder.makeExactLiteral(BigDecimal.ZERO), newInputRef); } else { return newInputRef; } } return inputRef; }
Example 8
Source File: RewriteProjectToFlattenRule.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if(inputRef instanceof MutableRexInputRef){ return new RexInputRef(inputRef.getIndex(), inputRef.getType()); } return super.visitInputRef(inputRef); }
Example 9
Source File: PigToSqlAggregateRule.java From calcite with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if (inputRef.getIndex() == oldProjCol && newProjectCol != null && inputRef.getType() == newProjectCol.getType()) { return newProjectCol; } return inputRef; }
Example 10
Source File: RelDecorrelator.java From calcite with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { final RexInputRef ref = getNewForOldInputRef(currentRel, map, inputRef); if (ref.getIndex() == inputRef.getIndex() && ref.getType() == inputRef.getType()) { return inputRef; // re-use old object, to prevent needless expr cloning } return ref; }
Example 11
Source File: RelDecorrelator.java From calcite with Apache License 2.0 | 5 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { if (currentRel instanceof Correlate) { // if this rel references corVar // and now it needs to be rewritten // it must have been pulled above the Correlate // replace the input ref to account for the LHS of the // Correlate final int leftInputFieldCount = ((Correlate) currentRel).getLeft().getRowType() .getFieldCount(); RelDataType newType = inputRef.getType(); if (projectPulledAboveLeftCorrelator) { newType = typeFactory.createTypeWithNullability(newType, true); } int pos = inputRef.getIndex(); RexInputRef newInputRef = new RexInputRef(leftInputFieldCount + pos, newType); if ((isCount != null) && isCount.contains(pos)) { return createCaseExpression( newInputRef, rexBuilder.makeExactLiteral(BigDecimal.ZERO), newInputRef); } else { return newInputRef; } } return inputRef; }
Example 12
Source File: PrelUtil.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public RexNode visitInputRef(RexInputRef inputRef) { return new RexInputRef(map.get(inputRef.getIndex()), inputRef.getType()); }