ORC
Input | Output | Alias |
---|---|---|
✔ | ✔ |
描述
Apache ORC 是一种广泛用于 Hadoop 生态系统的列式存储格式。
数据类型匹配
下表比较了支持的 ORC 数据类型及其对应的 ClickHouse 数据类型 在 INSERT
和 SELECT
查询中的对应关系。
ORC 数据类型 (INSERT ) | ClickHouse 数据类型 | ORC 数据类型 (SELECT ) |
---|---|---|
Boolean | UInt8 | Boolean |
Tinyint | Int8/UInt8/Enum8 | Tinyint |
Smallint | Int16/UInt16/Enum16 | Smallint |
Int | Int32/UInt32 | Int |
Bigint | Int64/UInt32 | Bigint |
Float | Float32 | Float |
Double | Float64 | Double |
Decimal | Decimal | Decimal |
Date | Date32 | Date |
Timestamp | DateTime64 | Timestamp |
String , Char , Varchar , Binary | String | Binary |
List | Array | List |
Struct | Tuple | Struct |
Map | Map | Map |
Int | IPv4 | Int |
Binary | IPv6 | Binary |
Binary | Int128/UInt128/Int256/UInt256 | Binary |
Binary | Decimal256 | Binary |
- 其他类型不支持。
- 数组可以嵌套,并且可以作为参数具有
Nullable
类型的值。Tuple
和Map
类型也可以嵌套。 - ClickHouse 表列的数据类型不必与对应的 ORC 数据字段相匹配。在插入数据时,ClickHouse 根据上述表格解析数据类型,然后 转换 数据为设置的 ClickHouse 表列的数据类型。
示例用法
插入数据
使用以下数据的 ORC 文件,命名为 football.orc
:
插入数据:
读取数据
使用 ORC
格式读取数据:
提示
ORC 是一种二进制格式,在终端上以人类可读的形式不显示。使用 INTO OUTFILE
输出 ORC 文件。
格式设置
设置 | 描述 | 默认值 |
---|---|---|
output_format_arrow_string_as_string | 对于字符串列使用 Arrow String 类型而不是二进制。 | false |
output_format_orc_compression_method | 输出 ORC 格式中使用的压缩方法。默认值 | none |
input_format_arrow_case_insensitive_column_matching | 忽略大小写以匹配 Arrow 列与 ClickHouse 列。 | false |
input_format_arrow_allow_missing_columns | 读取 Arrow 数据时允许缺少列。 | false |
input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference | 在 Arrow 格式的模式推断中允许跳过具有不支持类型的列。 | false |
要与 Hadoop 交换数据,可以使用 HDFS 表引擎。