Package org.apache.iceberg.orc
Class ORCSchemaUtil
java.lang.Object
org.apache.iceberg.orc.ORCSchemaUtil
Utilities for mapping Iceberg to ORC schemas.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumstatic enum
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic org.apache.orc.TypeDescriptionbuildOrcProjection(Schema schema, org.apache.orc.TypeDescription originalOrcSchema) Converts an Iceberg schema to a corresponding ORC schema within the context of an existing ORC file schema.static org.apache.orc.TypeDescriptionstatic Schemaconvert(org.apache.orc.TypeDescription orcSchema) Convert an ORC schema to an Iceberg schema.static intfieldId(org.apache.orc.TypeDescription orcType) idToOrcName(Schema schema) Generates mapping from field IDs to ORC qualified names.
- 
Field Details- 
ICEBERG_BINARY_TYPE_ATTRIBUTEThe name of the ORCTypeDescriptionattribute indicating the Iceberg type corresponding to an ORC binary type. The values for this attribute are denoted inBinaryType.- See Also:
 
- 
ICEBERG_LONG_TYPE_ATTRIBUTEThe name of the ORCTypeDescriptionattribute indicating the Iceberg type corresponding to an ORC long type. The values for this attribute are denoted inLongType.- See Also:
 
 
- 
- 
Method Details- 
convert
- 
convertConvert an ORC schema to an Iceberg schema. This method handles the convertion from the original Iceberg column mapping IDs if present in the ORC column attributes, otherwise, ORC columns with no Iceberg IDs will be ignored and skipped in the conversion.- Returns:
- the Iceberg schema
- Throws:
- IllegalArgumentException- if ORC schema has no columns with Iceberg ID attributes
 
- 
buildOrcProjectionpublic static org.apache.orc.TypeDescription buildOrcProjection(Schema schema, org.apache.orc.TypeDescription originalOrcSchema) Converts an Iceberg schema to a corresponding ORC schema within the context of an existing ORC file schema. This method also handles schema evolution from the original ORC file schema to the given Iceberg schema. It builds the desired reader schema with the schema evolution rules and pass that down to the ORC reader, which would then use its schema evolution to map that to the writer’s schema.Example: Iceberg writer ORC writer struct<a (1): int, b (2): string> struct<a: int, b: string> struct<a (1): struct<b (2): string, c (3): date>> struct<a: struct<b:string, c:date>>Iceberg reader ORC readerstruct<a (2): string, c (3): date> struct<b: string, c: date> struct<aa (1): struct<cc (3): date, bb (2): string>> struct<a: struct<c:date, b:string>>- Parameters:
- schema- an Iceberg schema
- originalOrcSchema- an existing ORC file schema
- Returns:
- the resulting ORC schema
 
- 
fieldIdpublic static int fieldId(org.apache.orc.TypeDescription orcType) 
- 
idToOrcNameGenerates mapping from field IDs to ORC qualified names. SeeIdToOrcNamefor details.
 
-