Class ParquetSchemaBuilder
java.lang.Object
org.apache.juneau.marshall.parquet.ParquetSchemaBuilder
Builds Parquet schema (list of SchemaElement) from Juneau bean ClassMeta.
Maps Java types to Parquet physical and logical types per the Parquet specification.
-
Constructor Summary
ConstructorsConstructorDescriptionParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling) Constructor.ParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling, int maxRecursionDepth) Constructor.ParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling, int maxRecursionDepth, boolean nativeLogicalTypes) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuildSchema(ClassMeta<?> cm) Builds the Parquet schema for the given bean class.buildSchema(ClassMeta<?> cm, Object sampleBean) Builds the Parquet schema, using a sample bean to resolve collection element types when generics are erased.buildSchemaForKeyValuePairs(Object keySample, Object valueSample) Builds the Parquet schema for a Map root with non-String keys (flat list-of-pairs: root.key, root.value).buildSchemaFromMap(Map<?, ?> map) Builds the Parquet schema for a Map root (single row, columns from map keys).static List<ParquetSchemaElement>getLeafColumns(List<ParquetSchemaElement> schema) Returns leaf (primitive) schema elements suitable for column chunk writing.
-
Constructor Details
-
ParquetSchemaBuilder
public ParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling) Constructor.- Parameters:
marshallingContext- The bean context for type resolution.writeDatesAsTimestamp- If true, Date/Calendar/Temporal map to INT64+TIMESTAMP_MILLIS; else to BYTE_ARRAY+STRING.cycleHandling- How to handle structural cycles when building schema.
-
ParquetSchemaBuilder
public ParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling, int maxRecursionDepth) Constructor.- Parameters:
marshallingContext- The bean context for type resolution.writeDatesAsTimestamp- If true, Date/Calendar/Temporal map to INT64+TIMESTAMP_MILLIS; else to BYTE_ARRAY+STRING.cycleHandling- How to handle structural cycles when building schema.maxRecursionDepth- Maximum expansion depth for self-referential bean types (GAP-13).
-
ParquetSchemaBuilder
public ParquetSchemaBuilder(MarshallingContext marshallingContext, boolean writeDatesAsTimestamp, ParquetCycleHandling cycleHandling, int maxRecursionDepth, boolean nativeLogicalTypes) Constructor.- Parameters:
marshallingContext- The bean context for type resolution.writeDatesAsTimestamp- If true, Date/Calendar/Temporal map to INT64+TIMESTAMP_MILLIS; else to BYTE_ARRAY+STRING.cycleHandling- How to handle structural cycles when building schema.maxRecursionDepth- Maximum expansion depth for self-referential bean types (GAP-13).nativeLogicalTypes- If true, emit binary-native DECIMAL/DATE/TIME/TIMESTAMP-micros logical types instead of the default string / TIMESTAMP-millis normalization (GAP-9/10).
-
-
Method Details
-
buildSchema
Builds the Parquet schema for the given bean class.- Parameters:
cm- The bean class metadata.- Returns:
- The depth-first list of schema elements (root first).
-
buildSchema
Builds the Parquet schema, using a sample bean to resolve collection element types when generics are erased.- Parameters:
cm- The bean class metadata.sampleBean- Optional sample instance; when provided, collection element types are resolved from actual values.- Returns:
- The depth-first list of schema elements (root first).
-
buildSchemaFromMap
Builds the Parquet schema for a Map root (single row, columns from map keys).- Parameters:
map- The map instance (keys become column names).- Returns:
- The depth-first list of schema elements (root first).
-
buildSchemaForKeyValuePairs
Builds the Parquet schema for a Map root with non-String keys (flat list-of-pairs: root.key, root.value).Each map entry becomes one Parquet row. Keys and values use native Parquet types.
- Parameters:
keySample- Sample key for type inference.valueSample- Sample value for type inference.- Returns:
- The depth-first list of schema elements (root first).
-
getLeafColumns
Returns leaf (primitive) schema elements suitable for column chunk writing.- Parameters:
schema- The full schema from buildSchema.- Returns:
- List of leaf elements with non-null paths.
-