本文整理汇总了Java中org.apache.calcite.rel.type.RelDataTypeField.getName方法的典型用法代码示例。如果您正苦于以下问题:Java RelDataTypeField.getName方法的具体用法?Java RelDataTypeField.getName怎么用?Java RelDataTypeField.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rel.type.RelDataTypeField
的用法示例。
在下文中一共展示了RelDataTypeField.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRelDataType
import org.apache.calcite.rel.type.RelDataTypeField; //导入方法依赖的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);
}
}
示例2: dictionaryEncodedField
import org.apache.calcite.rel.type.RelDataTypeField; //导入方法依赖的package包/类
private RelDataTypeField dictionaryEncodedField(RelDataTypeField field) {
return new RelDataTypeFieldImpl(field.getName(), field.getIndex(), dictionaryDataType);
}
示例3: visitParquetScanPrel
import org.apache.calcite.rel.type.RelDataTypeField; //导入方法依赖的package包/类
private PrelWithDictionaryInfo visitParquetScanPrel(ParquetScanPrel parquetScanPrel, Void value) throws RuntimeException {
final ReadDefinition readDefinition = parquetScanPrel.getTableMetadata().getReadDefinition();
if (readDefinition == null || readDefinition.getExtendedProperty() == null) {
return new PrelWithDictionaryInfo(parquetScanPrel);
}
// Make sure we don't apply global dictionary on columns that have conditions pushed into the scan
final Set<String> columnsPushedToScan = new HashSet<>();
if (parquetScanPrel.getConditions() != null) {
Iterables.addAll(columnsPushedToScan, Iterables.transform(parquetScanPrel.getConditions(), FilterCondition.EXTRACT_COLUMN_NAME));
}
final Map<String, String> dictionaryEncodedColumnsToDictionaryFilePath = Maps.newHashMap();
long dictionaryVersion = -1;
final ParquetDatasetXAttr xAttr = ParquetDatasetXAttrSerDe.PARQUET_DATASET_XATTR_SERIALIZER.revert(
readDefinition.getExtendedProperty().toByteArray());
final DictionaryEncodedColumns dictionaryEncodedColumns = xAttr.getDictionaryEncodedColumns();
if (dictionaryEncodedColumns != null) {
dictionaryVersion = dictionaryEncodedColumns.getVersion();
// Construct paths to dictionary files based on the version found in namespace. Do NOT look for files during planning.
final Path dictionaryRootPath = new Path(dictionaryEncodedColumns.getRootPath());
for (String dictionaryEncodedColumn : dictionaryEncodedColumns.getColumnsList()) {
if (!columnsPushedToScan.contains(dictionaryEncodedColumn)) {
dictionaryEncodedColumnsToDictionaryFilePath.put(dictionaryEncodedColumn,
GlobalDictionaryBuilder.dictionaryFilePath(dictionaryRootPath, dictionaryEncodedColumn).toString());
}
}
}
if (dictionaryEncodedColumnsToDictionaryFilePath.isEmpty()) {
return new PrelWithDictionaryInfo(parquetScanPrel);
}
final StoragePluginId storagePluginId = parquetScanPrel.getPluginId();
boolean encodedColumns = false;
final List<RelDataTypeField> newFields = Lists.newArrayList();
final GlobalDictionaryFieldInfo[] fieldInfos = new GlobalDictionaryFieldInfo[parquetScanPrel.getRowType().getFieldCount()];
final List<GlobalDictionaryFieldInfo> globalDictionaryColumns = Lists.newArrayList();
for (int i = 0; i < parquetScanPrel.getRowType().getFieldCount(); ++i) {
final RelDataTypeField field = parquetScanPrel.getRowType().getFieldList().get(i);
if (dictionaryEncodedColumnsToDictionaryFilePath.containsKey(field.getName())) {
fieldInfos[i] = new GlobalDictionaryFieldInfo(
dictionaryVersion,
field.getName(),
storagePluginId,
CompleteType.fromMinorType(TypeInferenceUtils.getMinorTypeFromCalciteType(field.getType())).getType(),
dictionaryEncodedColumnsToDictionaryFilePath.get(field.getName()),
new RelDataTypeFieldImpl(field.getName(), field.getIndex(), field.getType()));
newFields.add(dictionaryEncodedField(field));
globalDictionaryColumns.add(fieldInfos[i]);
encodedColumns = true;
} else {
fieldInfos[i] = null;
newFields.add(field);
}
}
if (!encodedColumns) {
return new PrelWithDictionaryInfo(parquetScanPrel);
}
final RelDataType newRelDataType = PrelWithDictionaryInfo.toRowDataType(newFields, parquetScanPrel.getCluster().getTypeFactory());
final ParquetScanPrel newParquetScanPrel = parquetScanPrel.cloneWithGlobalDictionaryColumns(globalDictionaryColumns, newRelDataType);
return new PrelWithDictionaryInfo(newParquetScanPrel, fieldInfos);
}