• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PrimitiveConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.parquet.io.api.PrimitiveConverter的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveConverter类的具体用法?Java PrimitiveConverter怎么用?Java PrimitiveConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PrimitiveConverter类属于org.apache.parquet.io.api包,在下文中一共展示了PrimitiveConverter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newConverter

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的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


示例2: ColumnReaderImpl

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
/**
 * creates a reader for triplets
 * @param path the descriptor for the corresponding column
 * @param pageReader the underlying store to read from
 */
public ColumnReaderImpl(ColumnDescriptor path, PageReader pageReader, PrimitiveConverter converter, ParsedVersion writerVersion) {
  this.path = checkNotNull(path, "path");
  this.pageReader = checkNotNull(pageReader, "pageReader");
  this.converter = checkNotNull(converter, "converter");
  this.writerVersion = writerVersion;
  DictionaryPage dictionaryPage = pageReader.readDictionaryPage();
  if (dictionaryPage != null) {
    try {
      this.dictionary = dictionaryPage.getEncoding().initDictionary(path, dictionaryPage);
      if (converter.hasDictionarySupport()) {
        converter.setDictionary(dictionary);
      }
    } catch (IOException e) {
      throw new ParquetDecodingException("could not decode the dictionary for " + path, e);
    }
  } else {
    this.dictionary = null;
  }
  this.totalValueCount = pageReader.getTotalValueCount();
  if (totalValueCount <= 0) {
    throw new ParquetDecodingException("totalValueCount '" + totalValueCount + "' <= 0");
  }
  consume();
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:30,代码来源:ColumnReaderImpl.java


示例3: getPrimitiveConverter

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
private PrimitiveConverter getPrimitiveConverter(ColumnDescriptor path) {
  Type currentType = schema;
  Converter currentConverter = recordConverter;
  for (String fieldName : path.getPath()) {
    final GroupType groupType = currentType.asGroupType();
    int fieldIndex = groupType.getFieldIndex(fieldName);
    currentType = groupType.getType(fieldName);
    currentConverter = currentConverter.asGroupConverter().getConverter(fieldIndex);
  }
  PrimitiveConverter converter = currentConverter.asPrimitiveConverter();
  return converter;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:13,代码来源:ColumnReadStoreImpl.java


示例4: State

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
private State(int id, PrimitiveColumnIO primitiveColumnIO, ColumnReader column, int[] nextLevel, GroupConverter[] groupConverterPath, PrimitiveConverter primitiveConverter) {
  this.id = id;
  this.primitiveColumnIO = primitiveColumnIO;
  this.maxDefinitionLevel = primitiveColumnIO.getDefinitionLevel();
  this.maxRepetitionLevel = primitiveColumnIO.getRepetitionLevel();
  this.column = column;
  this.nextLevel = nextLevel;
  this.groupConverterPath = groupConverterPath;
  this.primitiveConverter = primitiveConverter;
  this.primitive = primitiveColumnIO.getType().asPrimitiveType().getPrimitiveTypeName();
  this.fieldPath = primitiveColumnIO.getFieldPath();
  this.primitiveField = fieldPath[fieldPath.length - 1];
  this.indexFieldPath = primitiveColumnIO.getIndexFieldPath();
  this.primitiveFieldIndex = indexFieldPath[indexFieldPath.length - 1];
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:16,代码来源:RecordReaderImplementation.java


示例5: validateValuesForPage

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
public static void validateValuesForPage(int rowGroupID, int pageID, DictionaryPage dictPage, DataPage page, ColumnDescriptor columnDesc, List<?> expectedValues) {
  TestStatistics.SingletonPageReader pageReader = new TestStatistics.SingletonPageReader(dictPage, page);
  PrimitiveConverter converter = getConverter(rowGroupID, pageID, columnDesc.getType(), expectedValues);
  ColumnReaderImpl column = new ColumnReaderImpl(columnDesc, pageReader, converter, null);
  for (int i = 0; i < pageReader.getTotalValueCount(); i += 1) {
    column.writeCurrentValueToConverter();
    column.consume();
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:10,代码来源:FileEncodingsIT.java


示例6: validateStatsForPage

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
private void validateStatsForPage(DataPage page, DictionaryPage dict, ColumnDescriptor desc) {
  SingletonPageReader reader = new SingletonPageReader(dict, page);
  PrimitiveConverter converter = getValidatingConverter(page, desc.getType());
  Statistics<?> stats = getStatisticsFromPageHeader(page);

  assertEquals("Statistics does not use the proper comparator",
      desc.getPrimitiveType().comparator().getClass(),
      stats.comparator().getClass());

  if (stats.isEmpty()) {
    // stats are empty if num nulls = 0 and there are no non-null values
    // this happens if stats are not written (e.g., when stats are too big)
    System.err.println(String.format(
        "No stats written for page=%s col=%s",
        page, Arrays.toString(desc.getPath())));
    return;
  }

  long numNulls = 0;
  ColumnReaderImpl column = new ColumnReaderImpl(desc, reader, converter, null);
  for (int i = 0; i < reader.getTotalValueCount(); i += 1) {
    if (column.getCurrentDefinitionLevel() >= desc.getMaxDefinitionLevel()) {
      column.writeCurrentValueToConverter();
    } else {
      numNulls += 1;
    }
    column.consume();
  }

  Assert.assertEquals(numNulls, stats.getNumNulls());

  System.err.println(String.format(
      "Validated stats min=%s max=%s nulls=%d for page=%s col=%s",
      stats.minAsString(),
      stats.maxAsString(), stats.getNumNulls(), page,
      Arrays.toString(desc.getPath())));
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:38,代码来源:TestStatistics.java


示例7: PrimitiveFieldHandler

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
public PrimitiveFieldHandler(PrimitiveConverter delegate, final ThriftField field, List<TProtocol> events) {
  this.delegate = delegate;
  this.events = events;
  final byte thriftType =
      field.getType().getType() == ThriftTypeID.ENUM ?
          ThriftTypeID.I32.getThriftType() : // enums are serialized as I32
          field.getType().getType().getThriftType();
  this.readFieldBegin = new ParquetProtocol("readFieldBegin()") {
    @Override
    public TField readFieldBegin() throws TException {
      return new TField(field.getName(), thriftType, field.getFieldId());
    }
  };
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ThriftRecordConverter.java


示例8: validateStatsForPage

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
private void validateStatsForPage(DataPage page, DictionaryPage dict,
                                  ColumnDescriptor desc) {
  SingletonPageReader reader = new SingletonPageReader(dict, page);
  PrimitiveConverter converter = getValidatingConverter(page, desc.getType());
  Statistics stats = getStatisticsFromPageHeader(page);

  long numNulls = 0;

  ColumnReader column = COL_READER_CTOR.newInstance(desc, reader, converter, null);
  for (int i = 0; i < reader.getTotalValueCount(); i += 1) {
    if (column.getCurrentDefinitionLevel() >= desc.getMaxDefinitionLevel()) {
      column.writeCurrentValueToConverter();
    } else {
      numNulls += 1;
    }
    column.consume();
  }

  if (numNulls != stats.getNumNulls()) {
    throw new BadStatsException("Number of nulls doesn't match.");
  }

  console.debug(String.format(
      "Validated stats min=%s max=%s nulls=%d for page=%s col=%s",
      stats.minAsString(),
      stats.maxAsString(), stats.getNumNulls(), page,
      Arrays.toString(desc.getPath())));
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:29,代码来源:CheckParquet251Command.java


示例9: newMemColumnReader

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
private ColumnReaderImpl newMemColumnReader(ColumnDescriptor path, PageReader pageReader) {
  PrimitiveConverter converter = getPrimitiveConverter(path);
  return new ColumnReaderImpl(path, pageReader, converter, writerVersion);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:5,代码来源:ColumnReadStoreImpl.java


示例10: FilteringPrimitiveConverter

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
public FilteringPrimitiveConverter(PrimitiveConverter delegate, ValueInspector[] valueInspectors) {
  this.delegate = checkNotNull(delegate, "delegate");
  this.valueInspectors = checkNotNull(valueInspectors, "valueInspectors");
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:5,代码来源:FilteringPrimitiveConverter.java


示例11: addValueToPrimitiveConverter

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
@Override
public void addValueToPrimitiveConverter(
    PrimitiveConverter primitiveConverter, ColumnReader columnReader) {
  primitiveConverter.addLong(columnReader.getLong());
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:6,代码来源:PrimitiveType.java


示例12: PrimitiveCounter

import org.apache.parquet.io.api.PrimitiveConverter; //导入依赖的package包/类
public PrimitiveCounter(PrimitiveConverter delegate) {
  this.delegate = delegate;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:4,代码来源:ThriftRecordConverter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CheckComboBox类代码示例发布时间:2022-05-23
下一篇:
Java LoadBalancerCommand类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap