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


Java PrimitiveType.getOriginalType方法代码示例

本文整理汇总了Java中org.apache.parquet.schema.PrimitiveType.getOriginalType方法的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveType.getOriginalType方法的具体用法?Java PrimitiveType.getOriginalType怎么用?Java PrimitiveType.getOriginalType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.parquet.schema.PrimitiveType的用法示例。


在下文中一共展示了PrimitiveType.getOriginalType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renameChildTypeToElement

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
/**
 * Changes the list inner '$data$' vector name to 'element' in the schema
 */
private Type renameChildTypeToElement(Type childType) {
  if (childType.isPrimitive()) {
    PrimitiveType childPrimitiveType = childType.asPrimitiveType();
    return new PrimitiveType(childType.getRepetition(),
      childPrimitiveType.getPrimitiveTypeName(),
      childPrimitiveType.getTypeLength(),
      "element",
      childPrimitiveType.getOriginalType(),
      childPrimitiveType.getDecimalMetadata(),
      null);
  } else {
    GroupType childGroupType = childType.asGroupType();
    return new GroupType(childType.getRepetition(),
      "element",
      childType.getOriginalType(),
      childGroupType.getFields());
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:22,代码来源:ParquetRecordWriter.java

示例2: newConverter

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
private PrimitiveConverter newConverter(int colIdx, byte vecType, PrimitiveType parquetType) {
  switch (vecType) {
    case Vec.T_BAD:
    case Vec.T_CAT:
    case Vec.T_STR:
    case Vec.T_UUID:
    case Vec.T_TIME:
      if (OriginalType.TIMESTAMP_MILLIS.equals(parquetType.getOriginalType()) || parquetType.getPrimitiveTypeName().equals(PrimitiveType.PrimitiveTypeName.INT96)) {
        return new TimestampConverter(colIdx, _writer);
      } else {
        boolean dictSupport = parquetType.getOriginalType() == OriginalType.UTF8 || parquetType.getOriginalType() == OriginalType.ENUM;
        return new StringConverter(_writer, colIdx, dictSupport);
      }
    case Vec.T_NUM:
      return new NumberConverter(colIdx, _writer);
    default:
      throw new UnsupportedOperationException("Unsupported type " + vecType);
  }
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:20,代码来源:ChunkConverter.java

示例3: showDetails

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
private static void showDetails(PrettyPrintWriter out, PrimitiveType type, int depth, MessageType container, List<String> cpath) {
  String name = Strings.repeat(".", depth) + type.getName();
  OriginalType otype = type.getOriginalType();
  Repetition rep = type.getRepetition();
  PrimitiveTypeName ptype = type.getPrimitiveTypeName();

  out.format("%s: %s %s", name, rep, ptype);
  if (otype != null) out.format(" O:%s", otype);

  if (container != null) {
    cpath.add(type.getName());
    String[] paths = cpath.toArray(new String[cpath.size()]);
    cpath.remove(cpath.size() - 1);

    ColumnDescriptor desc = container.getColumnDescription(paths);

    int defl = desc.getMaxDefinitionLevel();
    int repl = desc.getMaxRepetitionLevel();
    out.format(" R:%d D:%d", repl, defl);
  }
  out.println();
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:23,代码来源:MetadataUtils.java

示例4: sortOrder

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
/**
 * @param primitive a primitive type with a logical type annotation
 * @return the "correct" sort order of the type that applications assume
 */
private static SortOrder sortOrder(PrimitiveType primitive) {
  OriginalType annotation = primitive.getOriginalType();
  if (annotation != null) {
    switch (annotation) {
      case INT_8:
      case INT_16:
      case INT_32:
      case INT_64:
      case DATE:
      case TIME_MICROS:
      case TIME_MILLIS:
      case TIMESTAMP_MICROS:
      case TIMESTAMP_MILLIS:
        return SortOrder.SIGNED;
      case UINT_8:
      case UINT_16:
      case UINT_32:
      case UINT_64:
      case ENUM:
      case UTF8:
      case BSON:
      case JSON:
        return SortOrder.UNSIGNED;
      case DECIMAL:
      case LIST:
      case MAP:
      case MAP_KEY_VALUE:
      case INTERVAL:
        return SortOrder.UNKNOWN;
    }
  }
  return defaultSortOrder(primitive.getPrimitiveTypeName());
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:38,代码来源:ParquetMetadataConverter.java

示例5: run

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public int run() throws IOException {
  Preconditions.checkArgument(targets != null && targets.size() >= 1,
      "A Parquet file is required.");
  Preconditions.checkArgument(targets.size() == 1,
      "Cannot process multiple Parquet files.");

  String source = targets.get(0);

  ParquetFileReader reader = ParquetFileReader.open(getConf(), qualifiedPath(source));
  MessageType schema = reader.getFileMetaData().getSchema();
  ColumnDescriptor descriptor = Util.descriptor(column, schema);
  PrimitiveType type = Util.primitive(column, schema);
  Preconditions.checkNotNull(type);

  DictionaryPageReadStore dictionaryReader;
  int rowGroup = 0;
  while ((dictionaryReader = reader.getNextDictionaryReader()) != null) {
    DictionaryPage page = dictionaryReader.readDictionaryPage(descriptor);

    Dictionary dict = page.getEncoding().initDictionary(descriptor, page);

    console.info("\nRow group {} dictionary for \"{}\":", rowGroup, column, page.getCompressedSize());
    for (int i = 0; i <= dict.getMaxId(); i += 1) {
      switch(type.getPrimitiveTypeName()) {
        case BINARY:
          if (type.getOriginalType() == OriginalType.UTF8) {
            console.info("{}: {}", String.format("%6d", i),
                Util.humanReadable(dict.decodeToBinary(i).toStringUsingUTF8(), 70));
          } else {
            console.info("{}: {}", String.format("%6d", i),
                Util.humanReadable(dict.decodeToBinary(i).getBytesUnsafe(), 70));
          }
          break;
        case INT32:
          console.info("{}: {}", String.format("%6d", i),
            dict.decodeToInt(i));
          break;
        case INT64:
          console.info("{}: {}", String.format("%6d", i),
              dict.decodeToLong(i));
          break;
        case FLOAT:
          console.info("{}: {}", String.format("%6d", i),
              dict.decodeToFloat(i));
          break;
        case DOUBLE:
          console.info("{}: {}", String.format("%6d", i),
              dict.decodeToDouble(i));
          break;
        default:
          throw new IllegalArgumentException(
              "Unknown dictionary type: " + type.getPrimitiveTypeName());
      }
    }

    reader.skipNextRowGroup();

    rowGroup += 1;
  }

  console.info("");

  return 0;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:67,代码来源:ShowDictionaryCommand.java

示例6: overrideSortOrderToSigned

import org.apache.parquet.schema.PrimitiveType; //导入方法依赖的package包/类
/**
 * Returns whether to use signed order min and max with a type. It is safe to
 * use signed min and max when the type is a string type and contains only
 * ASCII characters (where the sign bit was 0). This checks whether the type
 * is a string type and uses {@code useSignedStringMinMax} to determine if
 * only ASCII characters were written.
 *
 * @param type a primitive type with a logical type annotation
 * @return true if signed order min/max can be used with this type
 */
private boolean overrideSortOrderToSigned(PrimitiveType type) {
  // even if the override is set, only return stats for string-ish types
  // a null type annotation is considered string-ish because some writers
  // failed to use the UTF8 annotation.
  OriginalType annotation = type.getOriginalType();
  return useSignedStringMinMax &&
      PrimitiveTypeName.BINARY == type.getPrimitiveTypeName() &&
      (annotation == null || STRING_TYPES.contains(annotation));
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:20,代码来源:ParquetMetadataConverter.java


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