本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例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();
}
};
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}