当前位置: 首页>>代码示例>>Java>>正文


Java OriginalType.LIST属性代码示例

本文整理汇总了Java中org.apache.parquet.schema.OriginalType.LIST属性的典型用法代码示例。如果您正苦于以下问题:Java OriginalType.LIST属性的具体用法?Java OriginalType.LIST怎么用?Java OriginalType.LIST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.parquet.schema.OriginalType的用法示例。


在下文中一共展示了OriginalType.LIST属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertColumnDescriptor

/**
 * Converts {@link ColumnDescriptor} to {@link SchemaPath} and converts any parquet LOGICAL LIST to something
 * the execution engine can understand (removes the extra 'list' and 'element' fields from the name)
 */
private static SchemaPath convertColumnDescriptor(final MessageType schema, final ColumnDescriptor columnDescriptor) {
  List<String> path = Lists.newArrayList(columnDescriptor.getPath());

  // go through the path and find all logical lists
  int index = 0;
  Type type = schema;
  while (!type.isPrimitive()) { // don't bother checking the last element in the path as it is a primitive type
    type = type.asGroupType().getType(path.get(index));
    if (type.getOriginalType() == OriginalType.LIST && LogicalListL1Converter.isSupportedSchema(type.asGroupType())) {
      // remove 'list'
      type = type.asGroupType().getType(path.get(index+1));
      path.remove(index+1);
      // remove 'element'
      type = type.asGroupType().getType(path.get(index+1));
      path.remove(index+1);
    }
    index++;
  }

  String[] schemaColDesc = new String[path.size()];
  path.toArray(schemaColDesc);
  return SchemaPath.getCompoundPath(schemaColDesc);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:ParquetRowiseReader.java

示例2: newFieldConverter

private Converter newFieldConverter(Type parquetType, ParentContainerUpdater updater)
{
    if (parquetType.isRepetition(Type.Repetition.REPEATED) && parquetType.getOriginalType() != OriginalType.LIST) {
        // A repeated field that is neither contained by a `LIST`- or `MAP`-annotated group nor
        // annotated by `LIST` or `MAP` should be interpreted as a required list of required
        // elements where the element type is the type of the field.
        if (parquetType.isPrimitive()) {
            return new RepeatedPrimitiveConverter(parquetType, updater);
        }
        else {
            return new RepeatedGroupConverter(parquetType, updater);
        }
    }
    else {
        return newConverter(parquetType, updater);
    }
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:17,代码来源:ParquetValueConverter.java

示例3: defaultGroupConverter

Converter defaultGroupConverter(OutputMutator mutator, GroupType groupType, final String nameForChild,
                                Collection<SchemaPath> c, List<Field> arrowSchema) {

  if (groupType.getOriginalType() == OriginalType.LIST && LogicalListL1Converter.isSupportedSchema(groupType)) {
    return new LogicalListL1Converter(
      nameForChild,
      mutator,
      getWriterProvider(),
      groupType,
      c,
      options,
      arrowSchema,
      containsCorruptedDates,
      readInt96AsTimeStamp);
  }

  final MapWriter map;
  if (groupType.isRepetition(REPEATED)) {
    if (arrowSchema != null) {
      //TODO assert this should never occur at this level
      // only parquet writer that writes arrowSchema doesn't write repeated fields except
      // as part of a LOGICAL LIST, thus this scenario (repeated + arrow schema present) can
      // only happen in LogicalList converter
      arrowSchema = handleRepeatedField(arrowSchema, groupType);
    }
    map = list(nameForChild).map();
  } else {
    map = getWriterProvider().map(nameForChild);
  }
  return new StructGroupConverter(mutator, map, groupType, c, options, arrowSchema, containsCorruptedDates, readInt96AsTimeStamp);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:ParquetGroupConverter.java

示例4: BagConverter

BagConverter(GroupType parquetSchema, FieldSchema pigSchema, ParentValueContainer parent, boolean numbersDefaultToZero, boolean columnIndexAccess) throws FrontendException {
  this.parent = parent;
  if (parquetSchema.getFieldCount() != 1) {
    throw new IllegalArgumentException("bags have only one field. " + parquetSchema + " size = " + parquetSchema.getFieldCount());
  }
  Type nestedType = parquetSchema.getType(0);

  ParentValueContainer childsParent;
  FieldSchema pigField;
  if (nestedType.isPrimitive() || nestedType.getOriginalType() == OriginalType.MAP || nestedType.getOriginalType() == OriginalType.LIST) {
    // Pig bags always contain tuples
    // In that case we need to wrap the value in an extra tuple
    childsParent = new ParentValueContainer() {
      @Override
      void add(Object value) {
        buffer.add(TF.newTuple(value));
      }};
    pigField = pigSchema.schema.getField(0).schema.getField(0);
  } else {
    childsParent = new ParentValueContainer() {
      @Override
      void add(Object value) {
        buffer.add((Tuple)value);
      }};
    pigField = pigSchema.schema.getField(0);
  }
  child = newConverter(pigField, nestedType, childsParent, numbersDefaultToZero, columnIndexAccess);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:28,代码来源:TupleConverter.java

示例5: filterBag

private Type filterBag(GroupType bagType, FieldSchema bagFieldSchema) throws FrontendException {
  if (LOG.isDebugEnabled()) LOG.debug("filtering BAG schema:\n" + bagType + "\nwith:\n " + bagFieldSchema);
  if (bagType.getFieldCount() != 1) {
    throw new RuntimeException("not unwrapping the right type, this should be a Bag: " + bagType);
  }
  Type nested = bagType.getType(0);
  FieldSchema innerField = bagFieldSchema.schema.getField(0);
  if (nested.isPrimitive() || nested.getOriginalType() == OriginalType.MAP || nested.getOriginalType() == OriginalType.LIST) {
    // Bags always contain tuples => we skip the extra tuple that was inserted in that case.
    innerField = innerField.schema.getField(0);
  }
  return bagType.withNewFields(filter(nested, innerField));
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:13,代码来源:PigSchemaConverter.java

示例6: List3Levels

/**
 * Will validate the structure of the list
 * @param list the Parquet List
 */
public List3Levels(GroupType list) {
  if (list.getOriginalType() != OriginalType.LIST || list.getFields().size() != 1) {
    throw new IllegalArgumentException("invalid list type: " + list);
  }
  this.list = list;
  Type repeatedField = list.getFields().get(0);
  if (repeatedField.isPrimitive() || !repeatedField.isRepetition(REPEATED) || repeatedField.asGroupType().getFields().size() != 1) {
    throw new IllegalArgumentException("invalid list type: " + list);
  }
  this.repeated = repeatedField.asGroupType();
  this.element = repeated.getFields().get(0);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:16,代码来源:List3Levels.java

示例7: getOriginalType

OriginalType getOriginalType(ConvertedType type) {
  switch (type) {
    case UTF8:
      return OriginalType.UTF8;
    case MAP:
      return OriginalType.MAP;
    case MAP_KEY_VALUE:
      return OriginalType.MAP_KEY_VALUE;
    case LIST:
      return OriginalType.LIST;
    case ENUM:
      return OriginalType.ENUM;
    case DECIMAL:
      return OriginalType.DECIMAL;
    case DATE:
      return OriginalType.DATE;
    case TIME_MILLIS:
      return OriginalType.TIME_MILLIS;
    case TIME_MICROS:
      return OriginalType.TIME_MICROS;
    case TIMESTAMP_MILLIS:
      return OriginalType.TIMESTAMP_MILLIS;
    case TIMESTAMP_MICROS:
      return OriginalType.TIMESTAMP_MICROS;
    case INTERVAL:
      return OriginalType.INTERVAL;
    case INT_8:
      return OriginalType.INT_8;
    case INT_16:
      return OriginalType.INT_16;
    case INT_32:
      return OriginalType.INT_32;
    case INT_64:
      return OriginalType.INT_64;
    case UINT_8:
      return OriginalType.UINT_8;
    case UINT_16:
      return OriginalType.UINT_16;
    case UINT_32:
      return OriginalType.UINT_32;
    case UINT_64:
      return OriginalType.UINT_64;
    case JSON:
      return OriginalType.JSON;
    case BSON:
      return OriginalType.BSON;
    default:
      throw new RuntimeException("Unknown converted type " + type);
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:50,代码来源:ParquetMetadataConverter.java


注:本文中的org.apache.parquet.schema.OriginalType.LIST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。