本文整理汇总了Java中org.apache.calcite.rel.type.RelDataTypeField.getType方法的典型用法代码示例。如果您正苦于以下问题:Java RelDataTypeField.getType方法的具体用法?Java RelDataTypeField.getType怎么用?Java RelDataTypeField.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.rel.type.RelDataTypeField
的用法示例。
在下文中一共展示了RelDataTypeField.getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFieldType
import org.apache.calcite.rel.type.RelDataTypeField; //导入方法依赖的package包/类
private RelDataType getFieldType(RelNode relNode, int i) {
final RelDataTypeField inputField =
relNode.getRowType().getFieldList().get(i);
return inputField.getType();
}
示例2: 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);
}