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


Java RelDataTypeField.getType方法代码示例

本文整理汇总了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();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DrillReduceAggregatesRule.java

示例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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:69,代码来源:GlobalDictionaryVisitor.java


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