当前位置: 首页>>代码示例>>Java>>正文


Java RelDataTypeFactory.FieldInfoBuilder方法代码示例

本文整理汇总了Java中org.apache.calcite.rel.type.RelDataTypeFactory.FieldInfoBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java RelDataTypeFactory.FieldInfoBuilder方法的具体用法?Java RelDataTypeFactory.FieldInfoBuilder怎么用?Java RelDataTypeFactory.FieldInfoBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.rel.type.RelDataTypeFactory的用法示例。


在下文中一共展示了RelDataTypeFactory.FieldInfoBuilder方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory)
{
  RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();
  if (fieldMapping != null) {
    for (Map.Entry<String, Class> entry : fieldMapping.entrySet()) {
      builder.add(entry.getKey(), convertField(typeFactory, entry.getValue()));
    }
  } else if (pojoClass != null) {
    for (Field field : pojoClass.getDeclaredFields()) {
      builder.add(field.getName(), convertField(typeFactory, field.getType()));
    }
  } else {
    throw new RuntimeException("Either fieldMapping or pojoClass needs to be set.");
  }

  return builder.build();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:19,代码来源:StreamEndpoint.java

示例2: OctopusTable

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public OctopusTable(MetaTable metaTable, OctopusSchema schema) {
    super(Object[].class);
    name = metaTable.getName();

    try {
        //tableType = Schema.TableType.valueOf(table.getType().name());
        tableType = Schema.TableType.TABLE; // FIXME
    } catch (IllegalArgumentException e) {
        tableType = Schema.TableType.TABLE;
    }

    RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
    RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
    for (MetaColumn metaColumn : metaTable.getColumns()) {
        String columnName = metaColumn.getName();
        //int jdbcType = metaColumn.getType().getJdbcType();
        int jdbcType = metaColumn.getType(); //FIXME
        SqlTypeName typeName = SqlTypeName.getNameForJdbcType(jdbcType);
        RelDataType sqlType = typeFactory.createSqlType(typeName);

        fieldInfo.add(columnName, sqlType);
    }
    protoRowType = RelDataTypeImpl.proto(fieldInfo.build());

    this.schema = schema;
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:27,代码来源:OctopusTable.java

示例3: getRelDataType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
RelProtoDataType getRelDataType(
		DatabaseMetaData metaData,
		String catalogName,
		String schemaName,
		String tableName
) throws SQLException {
	if (journalledTableKeys.containsKey(tableName)) {
		// 1: Find columns for journal table
		RelDataType relDataType = super
				.getRelDataType(metaData, catalogName, schemaName, journalNameFor(tableName))
				.apply(new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT) {
					@Override
					public RelDataType copyType(RelDataType type) {
						return type;
					}
				});

		RelDataTypeFactory.FieldInfoBuilder fieldInfo = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT).builder();

		// 2: Filter out journal-implementation columns
		for (RelDataTypeField field : relDataType.getFieldList()) {
			String fieldName = field.getName();
			if (fieldName.equals(versionField) || fieldName.equals(subsequentVersionField)) {
				continue;
			}
			fieldInfo.add(field);
		}

		return RelDataTypeImpl.proto(fieldInfo.build());
	} else {
		return super.getRelDataType(metaData, catalogName, schemaName, tableName);
	}
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:35,代码来源:JournalledJdbcSchema.java

示例4: toRowDataType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
static RelDataType toRowDataType(Collection<RelDataTypeField> fields, RelDataTypeFactory factory) {
  final RelDataTypeFactory.FieldInfoBuilder builder = new RelDataTypeFactory.FieldInfoBuilder(factory);
  for (RelDataTypeField field: fields) {
    builder.add(field);
  }
  return builder.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:PrelWithDictionaryInfo.java

示例5: toCalciteRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
/**
 * Create an instance of {@code RelDataType} so it can be used to create a table.
 */
public static RelProtoDataType toCalciteRowType(final BeamRecordSqlType that) {
  return new RelProtoDataType() {
    @Override
    public RelDataType apply(RelDataTypeFactory a) {
      RelDataTypeFactory.FieldInfoBuilder builder = a.builder();
      for (int idx = 0; idx < that.getFieldNames().size(); ++idx) {
        builder.add(that.getFieldNameByIndex(idx), toCalciteType(that.getFieldTypeByIndex(idx)));
      }
      return builder.build();
    }
  };
}
 
开发者ID:apache,项目名称:beam,代码行数:16,代码来源:CalciteUtils.java

示例6: getRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory)
{
  String schema = (String)operands.get(CSV_SCHEMA);
  RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();

  DelimitedSchema delimitedSchema = new DelimitedSchema(schema);
  for (DelimitedSchema.Field field : delimitedSchema.getFields()) {
    builder.add(field.getName(), convertField(typeFactory, field.getType()));
  }

  return builder.build();
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:14,代码来源:CSVMessageFormat.java

示例7: deriveRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType deriveRowType() {
    final List<RelDataTypeField> fieldList = table.getRowType().getFieldList();
    final RelDataTypeFactory.FieldInfoBuilder builder =
            getCluster().getTypeFactory().builder();
    for (int i = 0; i < table.getRowType().getFieldCount(); i++) {
        builder.add(fieldList.get(i));
    }
    return builder.build();
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:11,代码来源:OctopusMetaModelTableScan.java

示例8: deriveRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType deriveRowType() {
    final List<RelDataTypeField> fieldList = table.getRowType().getFieldList();
    final RelDataTypeFactory.FieldInfoBuilder builder =
            getCluster().getTypeFactory().builder();
    for (int field : fields) {
        builder.add(fieldList.get(field));
    }
    return builder.build();
}
 
开发者ID:twilmes,项目名称:sql-gremlin,代码行数:11,代码来源:GremlinTableScan.java

示例9: deriveRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType deriveRowType() {
    final List<RelDataTypeField> fieldList = table.getRowType().getFieldList();
    final RelDataTypeFactory.FieldInfoBuilder builder = getCluster().getTypeFactory().builder();
    for (int field : fields) {
        builder.add(fieldList.get(field));
    }
    return getCluster().getTypeFactory().createStructType(builder);
}
 
开发者ID:apache,项目名称:kylin,代码行数:10,代码来源:OLAPTableScan.java

示例10: deriveRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private RelDataType deriveRowType(RelDataTypeFactory typeFactory) {
    RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
    for (ColumnDesc column : sourceColumns) {
        RelDataType sqlType = createSqlType(typeFactory, column.getUpgradedType(), column.isNullable());
        sqlType = SqlTypeUtil.addCharsetAndCollation(sqlType, typeFactory);
        fieldInfo.add(column.getName(), sqlType);
    }
    return typeFactory.createStructType(fieldInfo);
}
 
开发者ID:apache,项目名称:kylin,代码行数:11,代码来源:OLAPTable.java

示例11: getRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
    RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();
    RelDataType anyType = typeFactory.createSqlType(SqlTypeName.ANY);
    builder.add("thread", anyType);
    builder.add("depth", typeFactory.createJavaType(int.class));
    builder.add("text", typeFactory.createJavaType(String.class));
    builder.add("objects", typeFactory.createMultisetType(anyType, -1));
    return builder.build();
}
 
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:11,代码来源:SnapshotThreadStacksTable.java


注:本文中的org.apache.calcite.rel.type.RelDataTypeFactory.FieldInfoBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。