use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFieldImpl in project samza by apache.
the class RelSchemaConverter method getRelFields.
private List<RelDataTypeField> getRelFields(List<SqlSchema.SqlField> fields) {
List<RelDataTypeField> relFields = new ArrayList<>();
for (SqlSchema.SqlField field : fields) {
String fieldName = field.getFieldName();
int fieldPos = field.getPosition();
RelDataType dataType = getRelDataType(field.getFieldSchema());
relFields.add(new RelDataTypeFieldImpl(fieldName, fieldPos, dataType));
}
return relFields;
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFieldImpl in project flink by apache.
the class StructuredRelDataType method create.
public static StructuredRelDataType create(FlinkTypeFactory factory, StructuredType structuredType) {
final List<RelDataTypeField> fields = new ArrayList<>();
for (int i = 0; i < structuredType.getAttributes().size(); i++) {
final StructuredAttribute attribute = structuredType.getAttributes().get(i);
final RelDataTypeField field = new RelDataTypeFieldImpl(attribute.getName(), i, factory.createFieldTypeFromLogicalType(attribute.getType()));
fields.add(field);
}
return new StructuredRelDataType(structuredType, fields);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFieldImpl in project drill by apache.
the class ConvertCountToDirectScan method getCountDirectScanRowType.
private RelDataType getCountDirectScanRowType(RelDataTypeFactory typeFactory) {
List<RelDataTypeField> fields = Lists.newArrayList();
fields.add(new RelDataTypeFieldImpl("count", 0, typeFactory.createSqlType(SqlTypeName.BIGINT)));
return new RelRecordType(fields);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFieldImpl in project drill by apache.
the class DrillFixedRelDataTypeImpl method addField.
private void addField(String columnName) {
RelDataTypeField newField = new RelDataTypeFieldImpl(columnName, fields.size(), typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.ANY), true));
fields.add(newField);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFieldImpl in project drill by axbaretto.
the class ConvertCountToDirectScan method constructDataType.
/**
* For each aggregate call creates field based on its name with bigint type.
* Constructs record type for created fields.
*
* @param aggregateRel aggregate relation expression
* @param fieldNames field names
* @return record type
*/
private RelDataType constructDataType(DrillAggregateRel aggregateRel, Collection<String> fieldNames) {
List<RelDataTypeField> fields = new ArrayList<>();
Iterator<String> filedNamesIterator = fieldNames.iterator();
int fieldIndex = 0;
while (filedNamesIterator.hasNext()) {
RelDataTypeField field = new RelDataTypeFieldImpl(filedNamesIterator.next(), fieldIndex++, aggregateRel.getCluster().getTypeFactory().createSqlType(SqlTypeName.BIGINT));
fields.add(field);
}
return new RelRecordType(fields);
}
Aggregations