Examples of SchemaElement


Examples of parquet.format.SchemaElement

  }

  private parquet.schema.Type[] convertChildren(Iterator<SchemaElement> schema, int childrenCount) {
    parquet.schema.Type[] result = new parquet.schema.Type[childrenCount];
    for (int i = 0; i < result.length; i++) {
      SchemaElement schemaElement = schema.next();
      if ((!schemaElement.isSetType() && !schemaElement.isSetNum_children())
          || (schemaElement.isSetType() && schemaElement.isSetNum_children())) {
        throw new RuntimeException("bad element " + schemaElement);
      }
      Repetition repetition = fromParquetRepetition(schemaElement.getRepetition_type());
      String name = schemaElement.getName();
      OriginalType originalType = null;
      if (schemaElement.isSetConverted_type()) {
        originalType = getOriginalType(schemaElement.converted_type);
      }

      // Create Parquet Type.
      if (schemaElement.type != null) {
        if (schemaElement.isSetType_length()) {
          result[i] = new PrimitiveType(
              repetition,
              getPrimitive(schemaElement.getType()),
              schemaElement.type_length,
              name,
              originalType);
        } else {
          result[i] = new PrimitiveType(
              repetition,
              getPrimitive(schemaElement.getType()),
              name,
              originalType);
        }
      } else {
        result[i] = new GroupType(
            repetition,
            name,
            originalType,
            convertChildren(schema, schemaElement.getNum_children()));
      }
    }
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.