本文整理汇总了Java中org.apache.calcite.rel.type.RelDataType.getFieldNames方法的典型用法代码示例。如果您正苦于以下问题:Java RelDataType.getFieldNames方法的具体用法?Java RelDataType.getFieldNames怎么用?Java RelDataType.getFieldNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rel.type.RelDataType
的用法示例。
在下文中一共展示了RelDataType.getFieldNames方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProjectRel
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
/**
* Create a project that converts the native scan output to expected output of Hive scan.
*/
private DrillProjectRel createProjectRel(final DrillScanRel hiveScanRel,
final Map<String, String> partitionColMapping, final DrillScanRel nativeScanRel) {
final List<RexNode> rexNodes = Lists.newArrayList();
final RexBuilder rb = hiveScanRel.getCluster().getRexBuilder();
final RelDataType hiveScanRowType = hiveScanRel.getRowType();
for (String colName : hiveScanRowType.getFieldNames()) {
final String dirColName = partitionColMapping.get(colName);
if (dirColName != null) {
rexNodes.add(createPartitionColumnCast(hiveScanRel, nativeScanRel, colName, dirColName, rb));
} else {
rexNodes.add(createColumnFormatConversion(hiveScanRel, nativeScanRel, colName, rb));
}
}
return DrillProjectRel.create(
hiveScanRel.getCluster(), hiveScanRel.getTraitSet(), nativeScanRel, rexNodes,
hiveScanRowType /* project rowtype and HiveScanRel rowtype should be the same */);
}
示例2: getOrdering
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static List<Ordering> getOrdering(RelCollation collation, RelDataType rowType) {
List<Ordering> orderExpr = Lists.newArrayList();
final List<String> childFields = rowType.getFieldNames();
for (RelFieldCollation fc: collation.getFieldCollations() ) {
FieldReference fr = new FieldReference(childFields.get(fc.getFieldIndex()), ExpressionPosition.UNKNOWN, false);
orderExpr.add(new Ordering(fc.getDirection(), fr, fc.nullDirection));
}
return orderExpr;
}
示例3: getColumns
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static ProjectPushInfo getColumns(RelDataType rowType, List<RexNode> projects) {
final List<String> fieldNames = rowType.getFieldNames();
if (fieldNames.isEmpty()) {
return null;
}
RefFieldsVisitor v = new RefFieldsVisitor(rowType);
for (RexNode exp : projects) {
PathSegment segment = exp.accept(v);
v.addColumn(segment);
}
return v.getInfo();
}
示例4: containsStarColumn
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static boolean containsStarColumn(RelDataType type) {
if (! type.isStruct()) {
return false;
}
List<String> fieldNames = type.getFieldNames();
for (String s : fieldNames) {
if (s.startsWith(STAR_COLUMN)) {
return true;
}
}
return false;
}
示例5: aggsToExpr
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static List<NamedExpression> aggsToExpr(
RelDataType rowType, RelNode input, ImmutableBitSet groupSet, List<AggregateCall> aggCalls) {
final List<String> fields = rowType.getFieldNames();
final List<String> childFields = input.getRowType().getFieldNames();
final List<NamedExpression> aggExprs = Lists.newArrayList();
for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) {
int aggExprOrdinal = groupSet.cardinality() + aggCall.i;
FieldReference ref = FieldReference.getWithQuotedRef(fields.get(aggExprOrdinal));
LogicalExpression expr = toExpr(aggCall.e, childFields);
NamedExpression ne = new NamedExpression(expr, ref);
aggExprs.add(ne);
}
return aggExprs;
}
示例6: getOrdering
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static List<Ordering> getOrdering(RelCollation collation, RelDataType rowType) {
List<Ordering> orderExpr = Lists.newArrayList();
final List<String> childFields = rowType.getFieldNames();
for (RelFieldCollation fc: collation.getFieldCollations() ) {
FieldReference fr = new FieldReference(childFields.get(fc.getFieldIndex()), false);
orderExpr.add(new Ordering(fc.getDirection(), fr, fc.nullDirection));
}
return orderExpr;
}
示例7: populateSemanticFields
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public static void populateSemanticFields(RelDataType relDataType, VirtualDatasetState state){
List<String> columnNames = relDataType.getFieldNames();
List<Column> columns = new ArrayList<>();
for (String colName : columnNames) {
ExpColumnReference colRef = new ExpColumnReference(colName);
columns.add(new Column(colName, colRef.wrap()));
}
state.setColumnsList(columns);
}
示例8: RefFieldsVisitor
import org.apache.calcite.rel.type.RelDataType; //导入方法依赖的package包/类
public RefFieldsVisitor(RelDataType rowType) {
super(true);
this.fieldNames = rowType.getFieldNames();
this.fields = rowType.getFieldList();
}