本文整理了Java中parquet.schema.Type.asPrimitiveType()
方法的一些代码示例,展示了Type.asPrimitiveType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.asPrimitiveType()
方法的具体详情如下:
包路径:parquet.schema.Type
类名称:Type
方法名:asPrimitiveType
暂无
代码示例来源:origin: prestodb/presto
public static Optional<RichColumnDescriptor> getDescriptor(List<PrimitiveColumnIO> columns, List<String> path)
{
checkArgument(path.size() >= 1, "Parquet nested path should have at least one component");
int index = getPathIndex(columns, path);
if (index == -1) {
return Optional.empty();
}
PrimitiveColumnIO columnIO = columns.get(index);
return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType()));
}
代码示例来源:origin: prestodb/presto
private void initializeColumnReaders()
{
for (PrimitiveColumnIO columnIO : columns) {
RichColumnDescriptor column = new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType());
columnReaders[columnIO.getId()] = PrimitiveColumnReader.createReader(column);
}
}
代码示例来源:origin: prestodb/presto
RichColumnDescriptor column = new RichColumnDescriptor(primitiveColumnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType());
return Optional.of(new PrimitiveField(type, repetitionLevel, definitionLevel, required, column, primitiveColumnIO.getId()));
代码示例来源:origin: prestodb/presto
.toArray(String[]::new);
ColumnPath columnPath = ColumnPath.get(path);
PrimitiveTypeName primitiveTypeName = messageType.getType(columnPath.toArray()).asPrimitiveType().getPrimitiveTypeName();
ColumnChunkMetaData column = ColumnChunkMetaData.get(
columnPath,
代码示例来源:origin: apache/incubator-gobblin
public void add(int fieldIndex, Binary value) {
switch (this.getType().getType(fieldIndex).asPrimitiveType().getPrimitiveTypeName()) {
case BINARY:
this.add(fieldIndex, new BinaryValue(value));
break;
case INT96:
this.add(fieldIndex, new Int96Value(value));
break;
default:
throw new UnsupportedOperationException(
this.getType().asPrimitiveType().getName() + " not supported for Binary");
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public PrimitiveTypeName getPrimitive() {
return getType().asPrimitiveType().getPrimitiveTypeName();
}
代码示例来源:origin: julienledem/redelm
public PrimitiveTypeName getPrimitive() {
return getType().asPrimitiveType().getPrimitiveTypeName();
}
代码示例来源:origin: com.twitter/parquet-tools
private static void showDetails(PrettyPrintWriter out, Type type, int depth, MessageType container, List<String> cpath) {
if (type instanceof GroupType) {
showDetails(out, type.asGroupType(), depth, container, cpath);
return;
} else if (type instanceof PrimitiveType) {
showDetails(out, type.asPrimitiveType(), depth, container, cpath);
return;
}
}
}
代码示例来源:origin: julienledem/redelm
public List<ColumnDescriptor> getColumns() {
List<String[]> paths = this.getPaths(0);
List<ColumnDescriptor> columns = new ArrayList<ColumnDescriptor>(paths.size());
for (String[] path : paths) {
// TODO: optimize this
columns.add(new ColumnDescriptor(path, getType(path).asPrimitiveType().getPrimitiveTypeName(), getMaxRepetitionLevel(path), getMaxDefinitionLevel(path)));
}
return columns;
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
public void visit(PrimitiveType primitiveType) {
if (!currentRequestedType.isPrimitive() ||
(this.strictTypeChecking && currentRequestedType.asPrimitiveType().getPrimitiveTypeName() != primitiveType.getPrimitiveTypeName())) {
incompatibleSchema(primitiveType, currentRequestedType);
}
PrimitiveColumnIO newIO = new PrimitiveColumnIO(primitiveType, current, currentRequestedIndex, leaves.size());
current.add(newIO);
leaves.add(newIO);
}
代码示例来源:origin: julienledem/redelm
@Override
void setLevels(int r, int d, String[] fieldPath, int[] fieldIndexPath, List<ColumnIO> repetition, List<ColumnIO> path) {
super.setLevels(r, d, fieldPath, fieldIndexPath, repetition, path);
this.columnDescriptor = new ColumnDescriptor(fieldPath, getType().asPrimitiveType().getPrimitiveTypeName(), getRepetitionLevel(), getDefinitionLevel());
this.path = path.toArray(new ColumnIO[path.size()]);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
protected static Converter getConverterFromDescription(Type type, int index, ConverterParent parent) {
if (type == null) {
return null;
}
if (type.isPrimitive()) {
return getConverterFromDescription(type.asPrimitiveType(), index, parent);
}
return getConverterFromDescription(type.asGroupType(), index, parent);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
void checkContains(Type subType) {
super.checkContains(subType);
if (!subType.isPrimitive()) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
PrimitiveType primitiveType = subType.asPrimitiveType();
if (this.primitive != primitiveType.primitive) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
}
代码示例来源:origin: julienledem/redelm
@Override
void checkContains(Type subType) {
super.checkContains(subType);
if (!subType.isPrimitive()) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
PrimitiveType primitiveType = subType.asPrimitiveType();
if (this.primitive != primitiveType.primitive) {
throw new InvalidRecordException(subType + " found: expected " + this);
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
void setLevels(int r, int d, String[] fieldPath, int[] fieldIndexPath, List<ColumnIO> repetition, List<ColumnIO> path) {
super.setLevels(r, d, fieldPath, fieldIndexPath, repetition, path);
PrimitiveType type = getType().asPrimitiveType();
this.columnDescriptor = new ColumnDescriptor(
fieldPath,
type.getPrimitiveTypeName(),
type.getTypeLength(),
getRepetitionLevel(),
getDefinitionLevel());
this.path = path.toArray(new ColumnIO[path.size()]);
}
代码示例来源:origin: julienledem/redelm
public ColumnDescriptor getColumnDescription(String[] path) {
int maxRep = getMaxRepetitionLevel(path);
int maxDef = getMaxDefinitionLevel(path);
PrimitiveTypeName type = getType(path).asPrimitiveType().getPrimitiveTypeName();
return new ColumnDescriptor(path, type, maxRep, maxDef);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public ColumnDescriptor getColumnDescription(String[] path) {
int maxRep = getMaxRepetitionLevel(path);
int maxDef = getMaxDefinitionLevel(path);
PrimitiveType type = getType(path).asPrimitiveType();
return new ColumnDescriptor(path, type.getPrimitiveTypeName(),
type.getTypeLength(), maxRep, maxDef);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
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];
}
代码示例来源:origin: org.apache.gobblin/gobblin-parquet
public void add(int fieldIndex, Binary value) {
switch (this.getType().getType(fieldIndex).asPrimitiveType().getPrimitiveTypeName()) {
case BINARY:
this.add(fieldIndex, new BinaryValue(value));
break;
case INT96:
this.add(fieldIndex, new Int96Value(value));
break;
default:
throw new UnsupportedOperationException(
this.getType().asPrimitiveType().getName() + " not supported for Binary");
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
protected Type union(Type toMerge, boolean strict) {
if (!toMerge.isPrimitive() || (strict && !primitive.equals(toMerge.asPrimitiveType().getPrimitiveTypeName()))) {
throw new IncompatibleSchemaModificationException("can not merge type " + toMerge + " into " + this);
}
Types.PrimitiveBuilder<PrimitiveType> builder = Types.primitive(
primitive, toMerge.getRepetition());
if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitive) {
builder.length(length);
}
return builder.named(getName());
}
}
内容来源于网络,如有侵权,请联系作者删除!