本文整理汇总了Java中parquet.schema.Type.isRepetition方法的典型用法代码示例。如果您正苦于以下问题:Java Type.isRepetition方法的具体用法?Java Type.isRepetition怎么用?Java Type.isRepetition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parquet.schema.Type
的用法示例。
在下文中一共展示了Type.isRepetition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeRecordFields
import parquet.schema.Type; //导入方法依赖的package包/类
private void writeRecordFields(GroupType schema, Schema tajoSchema,
Tuple tuple) {
List<Type> fields = schema.getFields();
// Parquet ignores Tajo NULL_TYPE columns, so the index may differ.
int index = 0;
for (int tajoIndex = 0; tajoIndex < tajoSchema.size(); ++tajoIndex) {
Column column = tajoSchema.getColumn(tajoIndex);
if (column.getDataType().getType() == TajoDataTypes.Type.NULL_TYPE) {
continue;
}
Datum datum = tuple.get(tajoIndex);
Type fieldType = fields.get(index);
if (!tuple.isNull(tajoIndex)) {
recordConsumer.startField(fieldType.getName(), index);
writeValue(fieldType, column, datum);
recordConsumer.endField(fieldType.getName(), index);
} else if (fieldType.isRepetition(Type.Repetition.REQUIRED)) {
throw new RuntimeException("Null-value for required field: " +
column.getSimpleName());
}
++index;
}
}
示例2: writeRecordFields
import parquet.schema.Type; //导入方法依赖的package包/类
private void writeRecordFields(GroupType schema, Schema avroSchema,
Map record) {
List<Type> fields = schema.getFields();
List<Schema.Field> avroFields = avroSchema.getFields();
int index = 0; // parquet ignores Avro nulls, so index may differ
for (int avroIndex = 0; avroIndex < avroFields.size(); avroIndex++) {
Schema.Field avroField = avroFields.get(avroIndex);
if (avroField.schema().getType().equals(Schema.Type.NULL)) {
continue;
}
Type fieldType = fields.get(index);
Object value = record.get(fieldKeyword.invoke(avroField));
if (value != null) {
recordConsumer.startField(fieldType.getName(), index);
writeValue(fieldType, avroField.schema(), value);
recordConsumer.endField(fieldType.getName(), index);
} else if (fieldType.isRepetition(Type.Repetition.REQUIRED)) {
throw new RuntimeException("Null-value for required field: " + avroField.name());
}
index++;
}
}
示例3: convertFields
import parquet.schema.Type; //导入方法依赖的package包/类
private Schema convertFields(List<Type> parquetFields) {
List<Column> columns = new ArrayList<Column>();
for (int i = 0; i < parquetFields.size(); ++i) {
Type fieldType = parquetFields.get(i);
if (fieldType.isRepetition(Type.Repetition.REPEATED)) {
throw new RuntimeException("REPEATED not supported outside LIST or" +
" MAP. Type: " + fieldType);
}
columns.add(convertField(fieldType));
}
Column[] columnsArray = new Column[columns.size()];
columnsArray = columns.toArray(columnsArray);
return new Schema(columnsArray);
}
示例4: add
import parquet.schema.Type; //导入方法依赖的package包/类
public void add(int fieldIndex, Primitive value) {
Type type = this.schema.getType(fieldIndex);
List<Object> list = this.data[fieldIndex];
if (!type.isRepetition(REPEATED) && !list.isEmpty()) {
throw new IllegalStateException(
"field " + fieldIndex + " (" + type.getName() + ") can not have more than one value: " + list);
} else {
list.add(value);
}
}