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


Java OriginalType.UTF8属性代码示例

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


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

示例1: newConverter

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,代码行数:19,代码来源:ChunkConverter.java

示例2: getOriginalType

OriginalType getOriginalType(ConvertedType type) {
  switch (type) {
    case UTF8:
      return OriginalType.UTF8;
    case MAP:
      return OriginalType.MAP;
    case MAP_KEY_VALUE:
      return OriginalType.MAP_KEY_VALUE;
    case LIST:
      return OriginalType.LIST;
    case ENUM:
      return OriginalType.ENUM;
    case DECIMAL:
      return OriginalType.DECIMAL;
    case DATE:
      return OriginalType.DATE;
    case TIME_MILLIS:
      return OriginalType.TIME_MILLIS;
    case TIME_MICROS:
      return OriginalType.TIME_MICROS;
    case TIMESTAMP_MILLIS:
      return OriginalType.TIMESTAMP_MILLIS;
    case TIMESTAMP_MICROS:
      return OriginalType.TIMESTAMP_MICROS;
    case INTERVAL:
      return OriginalType.INTERVAL;
    case INT_8:
      return OriginalType.INT_8;
    case INT_16:
      return OriginalType.INT_16;
    case INT_32:
      return OriginalType.INT_32;
    case INT_64:
      return OriginalType.INT_64;
    case UINT_8:
      return OriginalType.UINT_8;
    case UINT_16:
      return OriginalType.UINT_16;
    case UINT_32:
      return OriginalType.UINT_32;
    case UINT_64:
      return OriginalType.UINT_64;
    case JSON:
      return OriginalType.JSON;
    case BSON:
      return OriginalType.BSON;
    default:
      throw new RuntimeException("Unknown converted type " + type);
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:50,代码来源:ParquetMetadataConverter.java

示例3: run

@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,代码行数:66,代码来源:ShowDictionaryCommand.java


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