Class ParquetSchemaElement

java.lang.Object
org.apache.juneau.marshall.parquet.ParquetSchemaElement

public final class ParquetSchemaElement extends Object
A Parquet schema element representing a field in the Parquet schema.

Maps to the SchemaElement struct in the parquet.thrift specification. Used for both primitive (leaf) and group (non-leaf) nodes.

Parquet Type Enum (Type):
  • BOOLEAN = 0
  • INT32 = 1
  • INT64 = 2
  • FLOAT = 4
  • DOUBLE = 5
  • BYTE_ARRAY = 6
  • FIXED_LEN_BYTE_ARRAY = 7
Field Repetition Type:
  • REQUIRED = 0
  • OPTIONAL = 1
  • REPEATED = 2
Converted Type (common values):
  • UTF8 = 0, ENUM = 4, DECIMAL = 5, TIMESTAMP_MILLIS = 9, INT_8 = 15, INT_16 = 16, INT_32 = 17, INT_64 = 18, MAP = 1, LIST = 3
  • Field Details

  • Constructor Details

    • ParquetSchemaElement

      public ParquetSchemaElement(String name, Integer type, Integer typeLength, Integer repetitionType, Integer numChildren, Integer convertedType, Integer logicalType, Integer scale, Integer precision, String path)
      Creates a schema element.
      Parameters:
      name - Field name (required).
      type - Parquet physical type (null for groups).
      typeLength - Byte length for FIXED_LEN_BYTE_ARRAY (null otherwise).
      repetitionType - REQUIRED/OPTIONAL/REPEATED (null for root).
      numChildren - Child count for groups (null for primitives).
      convertedType - ConvertedType enum value (null if none).
      logicalType - LogicalType union discriminant (null if none).
      scale - Scale for DECIMAL (null otherwise).
      precision - Precision for DECIMAL (null otherwise).
      path - Dotted path for leaf columns (e.g. "db.port").
  • Method Details

    • writeTo

      public void writeTo(org.apache.juneau.marshall.parquet.ThriftCompactEncoder enc, boolean emitLogicalTypes) throws IOException
      Writes this schema element to the Thrift Compact Protocol encoder.

      When emitLogicalTypes is false (the default) only the physical type and the legacy convertedType discriminant are written, matching the historical wire shape. When true, an explicit LogicalType union (parquet.thrift field 10) is additionally emitted for ambiguous physical representations. The first-pass scope is UUID only: the one type whose round-trip currently relies on the FIXED_LEN_BYTE_ARRAY physical-type signal alone. The convertedType field is still written alongside the union so that readers that consume only the legacy field (including older Juneau versions) continue to work unchanged.

      Parameters:
      enc - The encoder.
      emitLogicalTypes - If true, additionally emit the LogicalType union for UUID columns.
      Throws:
      IOException - If an I/O error occurs.
    • isLeaf

      public boolean isLeaf()
      Returns true if this is a leaf (primitive) column.
      Returns:
      true if this element has a type and no children.