本文整理汇总了Java中org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT64属性的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveTypeName.INT64属性的具体用法?Java PrimitiveTypeName.INT64怎么用?Java PrimitiveTypeName.INT64使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName
的用法示例。
在下文中一共展示了PrimitiveTypeName.INT64属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
@Test
public void test() throws IOException {
MemPageStore memPageStore = new MemPageStore(10);
ColumnDescriptor col = new ColumnDescriptor(path , PrimitiveTypeName.INT64, 2, 2);
LongStatistics stats = new LongStatistics();
PageWriter pageWriter = memPageStore.getPageWriter(col);
pageWriter.writePage(BytesInput.from(new byte[735]), 209, stats, BIT_PACKED, BIT_PACKED, PLAIN);
pageWriter.writePage(BytesInput.from(new byte[743]), 209, stats, BIT_PACKED, BIT_PACKED, PLAIN);
pageWriter.writePage(BytesInput.from(new byte[743]), 209, stats, BIT_PACKED, BIT_PACKED, PLAIN);
pageWriter.writePage(BytesInput.from(new byte[735]), 209, stats, BIT_PACKED, BIT_PACKED, PLAIN);
PageReader pageReader = memPageStore.getPageReader(col);
long totalValueCount = pageReader.getTotalValueCount();
System.out.println(totalValueCount);
int total = 0;
do {
DataPage readPage = pageReader.readPage();
total += readPage.getValueCount();
System.out.println(readPage);
// TODO: assert
} while (total < totalValueCount);
}
示例2: getPrimitive
public PrimitiveTypeName getPrimitive(Type type) {
switch (type) {
case BYTE_ARRAY: // TODO: rename BINARY and remove this switch
return PrimitiveTypeName.BINARY;
case INT64:
return PrimitiveTypeName.INT64;
case INT32:
return PrimitiveTypeName.INT32;
case BOOLEAN:
return PrimitiveTypeName.BOOLEAN;
case FLOAT:
return PrimitiveTypeName.FLOAT;
case DOUBLE:
return PrimitiveTypeName.DOUBLE;
case INT96:
return PrimitiveTypeName.INT96;
case FIXED_LEN_BYTE_ARRAY:
return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY;
default:
throw new RuntimeException("Unknown type " + type);
}
}
示例3: convertType
private static Type convertType(final String name, final TypeInfo typeInfo, final Repetition repetition) {
if (typeInfo.getCategory().equals(Category.PRIMITIVE)) {
if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.BINARY, name);
} else if (typeInfo.equals(TypeInfoFactory.intTypeInfo) ||
typeInfo.equals(TypeInfoFactory.shortTypeInfo) ||
typeInfo.equals(TypeInfoFactory.byteTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.INT32, name);
} else if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.INT64, name);
} else if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.DOUBLE, name);
} else if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.FLOAT, name);
} else if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) {
return new PrimitiveType(repetition, PrimitiveTypeName.BOOLEAN, name);
} else if (typeInfo.equals(TypeInfoFactory.binaryTypeInfo)) {
// TODO : binaryTypeInfo is a byte array. Need to map it
throw new UnsupportedOperationException("Binary type not implemented");
} else if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) {
throw new UnsupportedOperationException("Timestamp type not implemented");
} else if (typeInfo.equals(TypeInfoFactory.voidTypeInfo)) {
throw new UnsupportedOperationException("Void type not implemented");
} else if (typeInfo.equals(TypeInfoFactory.unknownTypeInfo)) {
throw new UnsupportedOperationException("Unknown type not implemented");
} else {
throw new IllegalArgumentException("Unknown type: " + typeInfo);
}
} else if (typeInfo.getCategory().equals(Category.LIST)) {
return convertArrayType(name, (ListTypeInfo) typeInfo);
} else if (typeInfo.getCategory().equals(Category.STRUCT)) {
return convertStructType(name, (StructTypeInfo) typeInfo);
} else if (typeInfo.getCategory().equals(Category.MAP)) {
return convertMapType(name, (MapTypeInfo) typeInfo);
} else if (typeInfo.getCategory().equals(Category.UNION)) {
throw new UnsupportedOperationException("Union type not implemented");
} else {
throw new IllegalArgumentException("Unknown type: " + typeInfo);
}
}