Class ParquetSchemaElement
java.lang.Object
org.apache.juneau.marshall.parquet.ParquetSchemaElement
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intConverted type: DATE (days since epoch).static final intConverted type: DECIMAL.static final intConverted type: ENUM.static final intConverted type: INT_16.static final intConverted type: INT_32.static final intConverted type: INT_64.static final intConverted type: INT_8.static final intConverted type: LIST.static final intConverted type: MAP.static final intConverted type: TIME_MICROS.static final intConverted type: TIME_MILLIS.static final intConverted type: TIMESTAMP_MICROS.static final intConverted type: TIMESTAMP_MILLIS.static final intConverted type: UTF8 (parquet.thrift ConvertedType).final IntegerDeprecated converted type.final IntegerLogical type discriminant (1=STRING, 5=DECIMAL, 8=TIMESTAMP, 14=UUID, etc.).final StringField name.final IntegerNumber of child elements.static final intField repetition type: OPTIONAL (parquet.thrift FieldRepetitionType).final StringPath from root (e.g.final IntegerPrecision for DECIMAL.static final intField repetition type: REPEATED (parquet.thrift FieldRepetitionType).final IntegerRepetition type.static final intField repetition type: REQUIRED (parquet.thrift FieldRepetitionType).final IntegerScale for DECIMAL.final IntegerParquet physical type.static final intParquet physical type: BOOLEAN.static final intParquet physical type: BYTE_ARRAY.static final intParquet physical type: DOUBLE.static final intParquet physical type: FIXED_LEN_BYTE_ARRAY.static final intParquet physical type: FLOAT.static final intParquet physical type: INT32.static final intParquet physical type: INT64.static final intParquet physical type: INT96 (legacy 12-byte timestamp; read-only).final IntegerByte length for FIXED_LEN_BYTE_ARRAY. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TYPE_BOOLEAN
Parquet physical type: BOOLEAN.- See Also:
-
TYPE_INT32
Parquet physical type: INT32.- See Also:
-
TYPE_INT64
Parquet physical type: INT64.- See Also:
-
TYPE_INT96
Parquet physical type: INT96 (legacy 12-byte timestamp; read-only).- See Also:
-
TYPE_FLOAT
Parquet physical type: FLOAT.- See Also:
-
TYPE_DOUBLE
Parquet physical type: DOUBLE.- See Also:
-
TYPE_BYTE_ARRAY
Parquet physical type: BYTE_ARRAY.- See Also:
-
TYPE_FIXED_LEN_BYTE_ARRAY
Parquet physical type: FIXED_LEN_BYTE_ARRAY.- See Also:
-
REQUIRED
Field repetition type: REQUIRED (parquet.thrift FieldRepetitionType).- See Also:
-
OPTIONAL
Field repetition type: OPTIONAL (parquet.thrift FieldRepetitionType).- See Also:
-
REPEATED
Field repetition type: REPEATED (parquet.thrift FieldRepetitionType).- See Also:
-
CONVERTED_UTF8
Converted type: UTF8 (parquet.thrift ConvertedType).- See Also:
-
CONVERTED_MAP
Converted type: MAP.- See Also:
-
CONVERTED_LIST
Converted type: LIST.- See Also:
-
CONVERTED_ENUM
Converted type: ENUM.- See Also:
-
CONVERTED_DECIMAL
Converted type: DECIMAL.- See Also:
-
CONVERTED_TIMESTAMP_MILLIS
Converted type: TIMESTAMP_MILLIS.- See Also:
-
CONVERTED_INT_8
Converted type: INT_8.- See Also:
-
CONVERTED_INT_16
Converted type: INT_16.- See Also:
-
CONVERTED_INT_32
Converted type: INT_32.- See Also:
-
CONVERTED_INT_64
Converted type: INT_64.- See Also:
-
CONVERTED_DATE
Converted type: DATE (days since epoch).- See Also:
-
CONVERTED_TIME_MILLIS
Converted type: TIME_MILLIS.- See Also:
-
CONVERTED_TIMESTAMP_MICROS
Converted type: TIMESTAMP_MICROS.- See Also:
-
CONVERTED_TIME_MICROS
Converted type: TIME_MICROS.- See Also:
-
name
Field name. Required. -
type
Parquet physical type. Null for group nodes. -
typeLength
Byte length for FIXED_LEN_BYTE_ARRAY. -
repetitionType
Repetition type. Null for root. -
numChildren
Number of child elements. Non-null for group nodes. -
convertedType
Deprecated converted type. Used for forward compatibility. -
logicalType
Logical type discriminant (1=STRING, 5=DECIMAL, 8=TIMESTAMP, 14=UUID, etc.). Null if none. -
scale
Scale for DECIMAL. -
precision
Precision for DECIMAL. -
path
Path from root (e.g. "host" or "db.port") for leaf columns.
-
-
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
emitLogicalTypesisfalse (the default) only the physical type and the legacyconvertedTypediscriminant are written, matching the historical wire shape. Whentrue , an explicitLogicalTypeunion (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 theFIXED_LEN_BYTE_ARRAYphysical-type signal alone. TheconvertedTypefield 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- Iftrue , additionally emit theLogicalTypeunion for UUID columns.- Throws:
IOException- If an I/O error occurs.
-
isLeaf
Returns true if this is a leaf (primitive) column.- Returns:
true if this element has a type and no children.
-