/** Equivalent to * {@link RelOptUtil#createProject(org.apache.calcite.rel.RelNode, java.util.List, java.util.List)} * for {@link MutableRel}. */ public static MutableRel of(MutableRel child, List<RexNode> exprList, List<String> fieldNameList) { final RelDataType rowType = RexUtil.createStructType(child.cluster.getTypeFactory(), exprList, fieldNameList, SqlValidatorUtil.F_SUGGESTER); return of(rowType, child, exprList); }
@Override public RelNode createProject(RelNode child, List<? extends RexNode> childExprs, List<String> fieldNames) { RelOptCluster cluster = child.getCluster(); RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames); RelTraitSet trait = TraitsUtil.getDefaultTraitSet(cluster, child.getTraitSet()); RelNode project = HiveProject.create(cluster, child, childExprs, rowType, trait, Collections.<RelCollation> emptyList()); return project; } }
@Override public RelNode createProject(RelNode child, List<? extends RexNode> childExprs, List<String> fieldNames) { RelOptCluster cluster = child.getCluster(); RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames); RelTraitSet trait = TraitsUtil.getDefaultTraitSet(cluster, child.getTraitSet()); RelNode project = HiveProject.create(cluster, child, childExprs, rowType, trait, Collections.<RelCollation> emptyList()); return project; } }
/** * Creates a HiveProject with no sort keys. * * @param child * input relational expression * @param exps * set of expressions for the input columns * @param fieldNames * aliases of the expressions */ public static HiveProject create(RelNode child, List<? extends RexNode> exps, List<String> fieldNames) throws CalciteSemanticException{ RelOptCluster cluster = child.getCluster(); // 1 Ensure columnNames are unique - CALCITE-411 if (fieldNames != null && !Util.isDistinct(fieldNames)) { String msg = "Select list contains multiple expressions with the same name." + fieldNames; throw new CalciteSemanticException(msg, UnsupportedFeature.Same_name_in_multiple_expressions); } RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), exps, fieldNames); return create(cluster, child, exps, rowType, Collections.<RelCollation> emptyList()); }
RexUtil.createStructType(cluster.getTypeFactory(), exprList, names, SqlValidatorUtil.F_SUGGESTER); stack.push(
/** * Creates a HiveProject with no sort keys. * * @param child * input relational expression * @param exps * set of expressions for the input columns * @param fieldNames * aliases of the expressions */ public static HiveProject create(RelNode child, List<? extends RexNode> exps, List<String> fieldNames) throws CalciteSemanticException{ RelOptCluster cluster = child.getCluster(); // 1 Ensure columnNames are unique - CALCITE-411 if (fieldNames != null && !Util.isDistinct(fieldNames)) { String msg = "Select list contains multiple expressions with the same name." + fieldNames; throw new CalciteSemanticException(msg, UnsupportedFeature.Same_name_in_multiple_expressions); } RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), exps, fieldNames); return create(cluster, child, exps, rowType, Collections.<RelCollation> emptyList()); }
RexUtil.createStructType(cluster.getTypeFactory(), exprList, names, SqlValidatorUtil.F_SUGGESTER); stack.push(
/** * Creates a record type with anonymous field names. * * @param typeFactory Type factory * @param exprs Expressions * @return Record type */ public static RelDataType createStructType( RelDataTypeFactory typeFactory, final List<RexNode> exprs) { return createStructType(typeFactory, exprs, null, null); }
@Deprecated // to be removed before 2.0 public static RelDataType createStructType( RelDataTypeFactory typeFactory, final List<? extends RexNode> exprs, List<String> names) { return createStructType(typeFactory, exprs, names, null); }
@Deprecated // to be removed before 2.0 public static RelDataType createStructType( RelDataTypeFactory typeFactory, final List<? extends RexNode> exprs, List<String> names) { return createStructType(typeFactory, exprs, names, null); }
@Deprecated // to be removed before 2.0 public LogicalProject(RelOptCluster cluster, RelNode input, List<RexNode> projects, List<String> fieldNames, int flags) { this(cluster, cluster.traitSetOf(RelCollations.EMPTY), input, projects, RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, null)); Util.discard(flags); }
@Deprecated // to be removed before 2.0 public LogicalProject(RelOptCluster cluster, RelNode input, List<RexNode> projects, List<String> fieldNames, int flags) { this(cluster, cluster.traitSetOf(RelCollations.EMPTY), input, projects, RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, null)); Util.discard(flags); }
static RelNode create(RelNode child, List<? extends RexNode> projects, List<String> fieldNames) { final RelOptCluster cluster = child.getCluster(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, SqlValidatorUtil.F_SUGGESTER); return create(child, projects, rowType); }
/** Creates a LogicalProject. */ public static LogicalProject create(final RelNode input, final List<? extends RexNode> projects, List<String> fieldNames) { final RelOptCluster cluster = input.getCluster(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, SqlValidatorUtil.F_SUGGESTER); return create(input, projects, rowType); }
static RelNode create(RelNode child, List<? extends RexNode> projects, List<String> fieldNames) { final RelOptCluster cluster = child.getCluster(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), projects, fieldNames, SqlValidatorUtil.F_SUGGESTER); return create(child, projects, rowType); }
@Override public RelNode createProject(RelNode child, List<? extends RexNode> childExprs, List<String> fieldNames) { RelOptCluster cluster = child.getCluster(); RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames); RelNode project = HiveProject.create(cluster, child, childExprs, rowType, child.getTraitSet(), Collections.<RelCollation> emptyList()); return project; } }
@Override public RelNode createProject(RelNode child, List<? extends RexNode> childExprs, List<String> fieldNames) { final RelOptCluster cluster = child.getCluster(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames, null); return DrillProjectRel.create(cluster, child.getTraitSet().plus(DRILL_LOGICAL), child, childExprs, rowType); } }
private RelNode rename(RelNode input, List<RelDataTypeField> inputFields, List<String> outputFieldNames) { List<RexNode> exprs = Lists.newArrayList(); for (RelDataTypeField field : inputFields) { RexNode expr = input.getCluster().getRexBuilder().makeInputRef(field.getType(), field.getIndex()); exprs.add(expr); } RelDataType rowType = RexUtil.createStructType(input.getCluster().getTypeFactory(), exprs, outputFieldNames); ProjectPrel proj = new ProjectPrel(input.getCluster(), input.getTraitSet(), input, exprs, rowType); return proj; }
@Override public RelNode createProject(RelNode child, List<? extends RexNode> childExprs, List<String> fieldNames) { final RelOptCluster cluster = child.getCluster(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames); final RelNode project = new ProjectPrel(cluster, child.getTraitSet().plus(Prel.DRILL_PHYSICAL), child, Lists.newArrayList(childExprs), rowType); return project; } }
private RelNode rename(RelNode input, List<RelDataTypeField> inputFields, List<String> outputFieldNames) { List<RexNode> exprs = Lists.newArrayList(); for (RelDataTypeField field : inputFields) { RexNode expr = input.getCluster().getRexBuilder().makeInputRef(field.getType(), field.getIndex()); exprs.add(expr); } RelDataType rowType = RexUtil.createStructType(input.getCluster().getTypeFactory(), exprs, outputFieldNames, null); ProjectPrel proj = new ProjectPrel(input.getCluster(), input.getTraitSet(), input, exprs, rowType); return proj; }