本文整理汇总了Java中org.apache.calcite.rex.RexBuilder.getTypeFactory方法的典型用法代码示例。如果您正苦于以下问题:Java RexBuilder.getTypeFactory方法的具体用法?Java RexBuilder.getTypeFactory怎么用?Java RexBuilder.getTypeFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rex.RexBuilder
的用法示例。
在下文中一共展示了RexBuilder.getTypeFactory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newColumnDefaultValue
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
@Override public RexNode newColumnDefaultValue(RelOptTable table,
int iColumn, InitializerContext context) {
final RexBuilder rexBuilder = context.getRexBuilder();
final RelDataTypeFactory typeFactory = rexBuilder.getTypeFactory();
switch (iColumn) {
case 0:
return rexBuilder.makeExactLiteral(new BigDecimal(123),
typeFactory.createSqlType(SqlTypeName.INTEGER));
case 1:
return rexBuilder.makeLiteral("Bob");
case 5:
return rexBuilder.makeExactLiteral(new BigDecimal(555),
typeFactory.createSqlType(SqlTypeName.INTEGER));
default:
return rexBuilder.constantNull();
}
}
示例2: RemoveCorrelationRexShuttle
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
public RemoveCorrelationRexShuttle(RexBuilder rexBuilder, boolean projectPulledAboveLeftCorrelator, RexInputRef nullIndicator, Set<Integer> isCount) {
this.projectPulledAboveLeftCorrelator = projectPulledAboveLeftCorrelator;
this.nullIndicator = nullIndicator; // may be null
this.isCount = ImmutableSet.copyOf(isCount);
this.rexBuilder = rexBuilder;
this.typeFactory = rexBuilder.getTypeFactory();
}
示例3: RemoveCorrelationRexShuttle
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
RemoveCorrelationRexShuttle(
RexBuilder rexBuilder,
boolean projectPulledAboveLeftCorrelator,
RexInputRef nullIndicator,
Set<Integer> isCount) {
this.projectPulledAboveLeftCorrelator =
projectPulledAboveLeftCorrelator;
this.nullIndicator = nullIndicator; // may be null
this.isCount = ImmutableSet.copyOf(isCount);
this.rexBuilder = rexBuilder;
this.typeFactory = rexBuilder.getTypeFactory();
}
示例4: create
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
/** Creates a cluster. */
public static QuarkMaterializeCluster create(RelOptPlannerHolder plannerHolder,
RexBuilder rexBuilder) {
return new QuarkMaterializeCluster(plannerHolder, rexBuilder.getTypeFactory(),
rexBuilder, new AtomicInteger(0), new HashMap<String, RelNode>());
}
示例5: create
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
/** Creates a cluster. */
public static RelOptCluster create(RelOptPlanner planner,
RexBuilder rexBuilder) {
return new RelOptCluster(planner, rexBuilder.getTypeFactory(),
rexBuilder, new AtomicInteger(0), new HashMap<String, RelNode>());
}
示例6: adjustCondition
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
/**
* Pulls the project above the semijoin and returns the resulting semijoin
* condition. As a result, the semijoin condition should be modified such
* that references to the LHS of a semijoin should now reference the
* children of the project that's on the LHS.
*
* @param project LogicalProject on the LHS of the semijoin
* @param semiJoin the semijoin
* @return the modified semijoin condition
*/
private RexNode adjustCondition(LogicalProject project, SemiJoin semiJoin) {
// create two RexPrograms -- the bottom one representing a
// concatenation of the project and the RHS of the semijoin and the
// top one representing the semijoin condition
RexBuilder rexBuilder = project.getCluster().getRexBuilder();
RelDataTypeFactory typeFactory = rexBuilder.getTypeFactory();
RelNode rightChild = semiJoin.getRight();
// for the bottom RexProgram, the input is a concatenation of the
// child of the project and the RHS of the semijoin
RelDataType bottomInputRowType =
SqlValidatorUtil.deriveJoinRowType(
project.getInput().getRowType(),
rightChild.getRowType(),
JoinRelType.INNER,
typeFactory,
null,
semiJoin.getSystemFieldList());
RexProgramBuilder bottomProgramBuilder =
new RexProgramBuilder(bottomInputRowType, rexBuilder);
// add the project expressions, then add input references for the RHS
// of the semijoin
for (Pair<RexNode, String> pair : project.getNamedProjects()) {
bottomProgramBuilder.addProject(pair.left, pair.right);
}
int nLeftFields = project.getInput().getRowType().getFieldCount();
List<RelDataTypeField> rightFields =
rightChild.getRowType().getFieldList();
int nRightFields = rightFields.size();
for (int i = 0; i < nRightFields; i++) {
final RelDataTypeField field = rightFields.get(i);
RexNode inputRef =
rexBuilder.makeInputRef(
field.getType(), i + nLeftFields);
bottomProgramBuilder.addProject(inputRef, field.getName());
}
RexProgram bottomProgram = bottomProgramBuilder.getProgram();
// input rowtype into the top program is the concatenation of the
// project and the RHS of the semijoin
RelDataType topInputRowType =
SqlValidatorUtil.deriveJoinRowType(
project.getRowType(),
rightChild.getRowType(),
JoinRelType.INNER,
typeFactory,
null,
semiJoin.getSystemFieldList());
RexProgramBuilder topProgramBuilder =
new RexProgramBuilder(
topInputRowType,
rexBuilder);
topProgramBuilder.addIdentity();
topProgramBuilder.addCondition(semiJoin.getCondition());
RexProgram topProgram = topProgramBuilder.getProgram();
// merge the programs and expand out the local references to form
// the new semijoin condition; it now references a concatenation of
// the project's child and the RHS of the semijoin
RexProgram mergedProgram =
RexProgramBuilder.mergePrograms(
topProgram,
bottomProgram,
rexBuilder);
return mergedProgram.expandLocalRef(
mergedProgram.getCondition());
}
示例7: create
import org.apache.calcite.rex.RexBuilder; //导入方法依赖的package包/类
/** Creates a cluster. */
public static RelOptCluster create(RelOptPlanner planner,
RexBuilder rexBuilder) {
return new RelOptCluster(planner, rexBuilder.getTypeFactory(),
rexBuilder, new AtomicInteger(0), new HashMap<String, RelNode>());
}