跳到主要内容
跳到主要内容

ORC

输入输出别名

描述

Apache ORC 是一种广泛用于 Hadoop 生态系统的列式存储格式。

数据类型匹配

下表比较了支持的 ORC 数据类型及其对应的 ClickHouse 数据类型INSERTSELECT 查询中的使用。

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
  • 不支持其他类型。
  • 数组可以嵌套,并且可以作为参数使用 Nullable 类型的值。TupleMap 类型也可以嵌套。
  • ClickHouse 表列的数据类型不必与对应的 ORC 数据字段匹配。在插入数据时,ClickHouse 根据上表解释数据类型,然后 转换 数据为 ClickHouse 表列设置的数据类型。

示例用法

插入数据

您可以使用以下命令从文件插入 ORC 数据到 ClickHouse 表中:

选择数据

您可以从 ClickHouse 表中选择数据,并使用以下命令将其保存为 ORC 格式的文件:

格式设置

设置描述默认值
output_format_arrow_string_as_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 表引擎