public final class ORCSchemaUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ORCSchemaUtil.BinaryType |
static class |
ORCSchemaUtil.LongType |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ICEBERG_BINARY_TYPE_ATTRIBUTE
The name of the ORC
TypeDescription attribute indicating the Iceberg type corresponding
to an ORC binary type. |
static java.lang.String |
ICEBERG_LONG_TYPE_ATTRIBUTE
The name of the ORC
TypeDescription attribute indicating the Iceberg type corresponding
to an ORC long type. |
Modifier and Type | Method and Description |
---|---|
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.
|
static org.apache.orc.TypeDescription |
convert(Schema schema) |
static Schema |
convert(org.apache.orc.TypeDescription orcSchema)
Convert an ORC schema to an Iceberg schema.
|
static int |
fieldId(org.apache.orc.TypeDescription orcType) |
static java.util.Map<java.lang.Integer,java.lang.String> |
idToOrcName(Schema schema)
Generates mapping from field IDs to ORC qualified names.
|
public static final java.lang.String ICEBERG_BINARY_TYPE_ATTRIBUTE
TypeDescription
attribute indicating the Iceberg type corresponding
to an ORC binary type. The values for this attribute are denoted in BinaryType
.public static final java.lang.String ICEBERG_LONG_TYPE_ATTRIBUTE
TypeDescription
attribute indicating the Iceberg type corresponding
to an ORC long type. The values for this attribute are denoted in LongType
.public static org.apache.orc.TypeDescription convert(Schema schema)
public static Schema convert(org.apache.orc.TypeDescription orcSchema)
java.lang.IllegalArgumentException
- if ORC schema has no columns with Iceberg ID attributespublic static org.apache.orc.TypeDescription buildOrcProjection(Schema schema, org.apache.orc.TypeDescription originalOrcSchema)
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 reader
struct<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>>
schema
- an Iceberg schemaoriginalOrcSchema
- an existing ORC file schemapublic static int fieldId(org.apache.orc.TypeDescription orcType)
public static java.util.Map<java.lang.Integer,java.lang.String> idToOrcName(Schema schema)
IdToOrcName
for details.