跳转到主要内容
输入输出别名

说明

Apache ORC 是一种在 Hadoop 生态中广泛使用的列式存储格式。

数据类型匹配

下表比较了支持的 ORC 数据类型,以及它们在 INSERTSELECT 查询中对应的 ClickHouse 数据类型
ORC 数据类型 (INSERT)ClickHouse 数据类型ORC 数据类型 (SELECT)
BooleanUInt8Boolean
TinyintInt8/UInt8/Enum8Tinyint
SmallintInt16/UInt16/Enum16Smallint
IntInt32/UInt32Int
BigintInt64/UInt32Bigint
FloatFloat32Float
DoubleFloat64Double
DecimalDecimalDecimal
DateDate32Date
TimestampDateTime64Timestamp
String, Char, Varchar, BinaryStringBinary
ListArrayList
StructTupleStruct
MapMapMap
IntIPv4Int
BinaryIPv6Binary
BinaryInt128/UInt128/Int256/UInt256Binary
BinaryDecimal256Binary
  • 不支持其他类型。
  • Array 可以嵌套,也可以接受 Nullable 类型的值作为参数。TupleMap 类型同样可以嵌套。
  • ClickHouse 表列的数据类型不必与对应的 ORC 数据字段一致。插入数据时,ClickHouse 会根据上表解释数据类型,然后将数据转换为 ClickHouse 表列设置的数据类型。

使用示例

插入数据

使用名为 football.orc、包含以下数据的 ORC 文件:
插入数据:

读取数据

使用 ORC 格式读取数据:
ORC 是一种二进制格式,无法在终端中以人类可读的形式显示。请使用 INTO OUTFILE 将 ORC 文件输出到文件。

格式设置

设置描述默认值
output_format_arrow_string_as_string对 String 列使用 Arrow String 类型,而非 Binary。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 格式执行 schema inference 时,允许跳过类型不受支持的列。false
要与 Hadoop 交换数据,可以使用 HDFS 表引擎
最后修改于 2026年7月2日