本文整理汇总了Java中org.apache.parquet.column.ColumnDescriptor.getMaxDefinitionLevel方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnDescriptor.getMaxDefinitionLevel方法的具体用法?Java ColumnDescriptor.getMaxDefinitionLevel怎么用?Java ColumnDescriptor.getMaxDefinitionLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.parquet.column.ColumnDescriptor
的用法示例。
在下文中一共展示了ColumnDescriptor.getMaxDefinitionLevel方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDetails
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的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();
}
示例2: getDataMode
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
private TypeProtos.DataMode getDataMode(ColumnDescriptor column) {
if (column.getMaxRepetitionLevel() > 0 ) {
return DataMode.REPEATED;
} else if (column.getMaxDefinitionLevel() == 0) {
return TypeProtos.DataMode.REQUIRED;
} else {
return TypeProtos.DataMode.OPTIONAL;
}
}
示例3: getReader
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
static VarLengthValuesColumn<?> getReader(DeprecatedParquetVectorizedReader parentReader, int allocateSize, ColumnDescriptor descriptor,
ColumnChunkMetaData columnChunkMetaData, boolean fixedLength, ValueVector v,
SchemaElement schemaElement
) throws ExecutionSetupException {
ConvertedType convertedType = schemaElement.getConverted_type();
switch (descriptor.getMaxDefinitionLevel()) {
case 0:
if (convertedType == null) {
return new VarLengthColumnReaders.VarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
switch (convertedType) {
case UTF8:
return new VarLengthColumnReaders.VarCharColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarCharVector) v, schemaElement);
case DECIMAL:
return new VarLengthColumnReaders.Decimal28Column(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableDecimalVector) v, schemaElement);
default:
return new VarLengthColumnReaders.VarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
default:
if (convertedType == null) {
return new VarLengthColumnReaders.NullableVarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
switch (convertedType) {
case UTF8:
return new VarLengthColumnReaders.NullableVarCharColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarCharVector) v, schemaElement);
case DECIMAL:
return new NullableDecimalColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableDecimalVector) v, schemaElement);
default:
return new VarLengthColumnReaders.NullableVarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
}
}
示例4: getDataMode
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
private TypeProtos.DataMode getDataMode(ColumnDescriptor column) {
if (isRepeated()) {
return DataMode.REPEATED;
} else if (column.getMaxDefinitionLevel() == 0) {
return TypeProtos.DataMode.REQUIRED;
} else {
return TypeProtos.DataMode.OPTIONAL;
}
}
示例5: getDataMode
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
private static TypeProtos.DataMode getDataMode(ColumnDescriptor column) {
if (column.getMaxRepetitionLevel() > 0 ) {
return TypeProtos.DataMode.REPEATED;
} else if (column.getMaxDefinitionLevel() == 0) {
return TypeProtos.DataMode.REQUIRED;
} else {
return TypeProtos.DataMode.OPTIONAL;
}
}
示例6: validateStatsForPage
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的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())));
}
示例7: validateStatsForPage
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的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())));
}
示例8: getReader
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
static VarLengthValuesColumn<?> getReader(ParquetRecordReader parentReader, int allocateSize, ColumnDescriptor descriptor,
ColumnChunkMetaData columnChunkMetaData, boolean fixedLength, ValueVector v,
SchemaElement schemaElement
) throws ExecutionSetupException {
ConvertedType convertedType = schemaElement.getConverted_type();
switch (descriptor.getMaxDefinitionLevel()) {
case 0:
if (convertedType == null) {
return new VarLengthColumnReaders.VarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (VarBinaryVector) v, schemaElement);
}
switch (convertedType) {
case UTF8:
case ENUM:
return new VarLengthColumnReaders.VarCharColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (VarCharVector) v, schemaElement);
case DECIMAL:
if (v instanceof Decimal28SparseVector) {
return new VarLengthColumnReaders.Decimal28Column(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (Decimal28SparseVector) v, schemaElement);
} else if (v instanceof Decimal38SparseVector) {
return new VarLengthColumnReaders.Decimal38Column(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (Decimal38SparseVector) v, schemaElement);
}
default:
return new VarLengthColumnReaders.VarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (VarBinaryVector) v, schemaElement);
}
default:
if (convertedType == null) {
return new VarLengthColumnReaders.NullableVarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
switch (convertedType) {
case UTF8:
case ENUM:
return new VarLengthColumnReaders.NullableVarCharColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarCharVector) v, schemaElement);
case DECIMAL:
if (v instanceof NullableDecimal28SparseVector) {
return new VarLengthColumnReaders.NullableDecimal28Column(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableDecimal28SparseVector) v, schemaElement);
} else if (v instanceof NullableDecimal38SparseVector) {
return new VarLengthColumnReaders.NullableDecimal38Column(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableDecimal38SparseVector) v, schemaElement);
}
default:
return new VarLengthColumnReaders.NullableVarBinaryColumn(parentReader, allocateSize, descriptor, columnChunkMetaData, fixedLength, (NullableVarBinaryVector) v, schemaElement);
}
}
}
示例9: dump
import org.apache.parquet.column.ColumnDescriptor; //导入方法依赖的package包/类
public static void dump(PrettyPrintWriter out, ColumnReadStoreImpl crstore, ColumnDescriptor column, long page, long total, long offset) throws IOException {
int dmax = column.getMaxDefinitionLevel();
ColumnReader creader = crstore.getColumnReader(column);
out.format("*** row group %d of %d, values %d to %d ***%n", page, total, offset, offset + creader.getTotalValueCount() - 1);
for (long i = 0, e = creader.getTotalValueCount(); i < e; ++i) {
int rlvl = creader.getCurrentRepetitionLevel();
int dlvl = creader.getCurrentDefinitionLevel();
out.format("value %d: R:%d D:%d V:", offset+i, rlvl, dlvl);
if (dlvl == dmax) {
PrimitiveStringifier stringifier = column.getPrimitiveType().stringifier();
switch (column.getType()) {
case FIXED_LEN_BYTE_ARRAY:
case INT96:
case BINARY:
out.print(stringifier.stringify(creader.getBinary()));
break;
case BOOLEAN:
out.print(stringifier.stringify(creader.getBoolean()));
break;
case DOUBLE:
out.print(stringifier.stringify(creader.getDouble()));
break;
case FLOAT:
out.print(stringifier.stringify(creader.getFloat()));
break;
case INT32:
out.print(stringifier.stringify(creader.getInteger()));
break;
case INT64:
out.print(stringifier.stringify(creader.getLong()));
break;
}
} else {
out.format("<null>");
}
out.println();
creader.consume();
}
}