Orc
The Apache Orc format allows to read and write Orc data.
Example of Use
CREATE TABLE user_behavior (
user_id BIGINT,
item_id BIGINT,
category_id BIGINT,
behavior STRING,
ts TIMESTAMP(3),
dt STRING
) PARTITIONED BY (dt) WITH (
'connector' = 'filesystem',
'path' = '/tmp/user_behavior',
'format' = 'orc'
)
Format Option
| Option | Required | Default | Type | Description |
|---|---|---|---|---|
| format | yes | (none) | String | Specify what format to use, here should be ‘orc’. |
Data Type Mapping
Orc format type mapping is compatible with Apache Hive. The following table lists the type mapping from Flink type to Orc type.
| Flink Data Type | Orc physical type | Orc logical type |
|---|---|---|
| Flink Data Type | Orc physical type | Orc logical type |
| CHAR | bytes | CHAR |
| VARCHAR | bytes | VARCHAR |
| STRING | bytes | STRING |
| BOOLEAN | long | BOOLEAN |
| BYTES | bytes | BINARY |
| DECIMAL | decimal | DECIMAL |
| TINYINT | long | BYTE |
| SMALLINT | long | SHORT |
| INT | long | INT |
| BIGINT | long | LONG |
| FLOAT | double | FLOAT |
| DOUBLE | double | DOUBLE |
| DATE | long | DATE |
| TIMESTAMP | timestamp | TIMESTAMP |
| ARRAY | none | LIST |
| MAP | none | MAP |
| ROW | none | STRUCT |