本文整理汇总了Java中org.apache.parquet.schema.Type.asPrimitiveType方法的典型用法代码示例。如果您正苦于以下问题:Java Type.asPrimitiveType方法的具体用法?Java Type.asPrimitiveType怎么用?Java Type.asPrimitiveType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.parquet.schema.Type
的用法示例。
在下文中一共展示了Type.asPrimitiveType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renameChildTypeToElement
import org.apache.parquet.schema.Type; //导入方法依赖的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());
}
}
示例2: createStats
import org.apache.parquet.schema.Type; //导入方法依赖的package包/类
/**
* Creates an empty {@code Statistics} instance for the specified type to be
* used for reading/writing the new min/max statistics used in the V2 format.
*
* @param type
* type of the column
* @return instance of a typed statistics class
*/
public static Statistics<?> createStats(Type type) {
PrimitiveType primitive = type.asPrimitiveType();
switch (primitive.getPrimitiveTypeName()) {
case INT32:
return new IntStatistics(primitive);
case INT64:
return new LongStatistics(primitive);
case FLOAT:
return new FloatStatistics(primitive);
case DOUBLE:
return new DoubleStatistics(primitive);
case BOOLEAN:
return new BooleanStatistics(primitive);
case BINARY:
case INT96:
case FIXED_LEN_BYTE_ARRAY:
return new BinaryStatistics(primitive);
default:
throw new UnknownColumnTypeException(primitive.getPrimitiveTypeName());
}
}
示例3: primitive
import org.apache.parquet.schema.Type; //导入方法依赖的package包/类
public static PrimitiveType primitive(MessageType schema, String[] path) {
Type current = schema;
for (String part : path) {
current = current.asGroupType().getType(part);
if (current.isPrimitive()) {
return current.asPrimitiveType();
}
}
return null;
}
示例4: start
import org.apache.parquet.schema.Type; //导入方法依赖的package包/类
@Override
final public void start() {
currentTuple = TF.newTuple(schemaSize);
if (elephantBirdCompatible) {
try {
int i = 0;
for (Type field : parquetSchema.getFields()) {
if (field.isPrimitive() && field.isRepetition(Repetition.OPTIONAL)) {
PrimitiveType primitiveType = field.asPrimitiveType();
switch (primitiveType.getPrimitiveTypeName()) {
case INT32:
currentTuple.set(i, I32_ZERO);
break;
case INT64:
currentTuple.set(i, I64_ZERO);
break;
case FLOAT:
currentTuple.set(i, FLOAT_ZERO);
break;
case DOUBLE:
currentTuple.set(i, DOUBLE_ZERO);
break;
case BOOLEAN:
currentTuple.set(i, I32_ZERO);
break;
}
}
++ i;
}
} catch (ExecException e) {
throw new RuntimeException(e);
}
}
}