Skip to main content
Skip to main content

Arrow

Description

Apache Arrow comes with two built-in columnar storage formats. ClickHouse supports read and write operations for these formats. Arrow is Apache Arrow’s "file mode" format. It is designed for in-memory random access.

Data Types Matching

The table below shows supported data types and how they match ClickHouse data types in INSERT and SELECT queries.

Arrow data type (INSERT)ClickHouse data typeArrow data type (SELECT)
BOOLBoolBOOL
UINT8, BOOLUInt8UINT8
INT8Int8/Enum8INT8
UINT16UInt16UINT16
INT16Int16/Enum16INT16
UINT32UInt32UINT32
INT32Int32INT32
UINT64UInt64UINT64
INT64Int64INT64
FLOAT, HALF_FLOATFloat32FLOAT32
DOUBLEFloat64FLOAT64
DATE32Date32UINT16
DATE64DateTimeUINT32
TIMESTAMP, TIME32, TIME64DateTime64UINT32
STRING, BINARYStringBINARY
STRING, BINARY, FIXED_SIZE_BINARYFixedStringFIXED_SIZE_BINARY
DECIMALDecimalDECIMAL
DECIMAL256Decimal256DECIMAL256
LISTArrayLIST
STRUCTTupleSTRUCT
MAPMapMAP
UINT32IPv4UINT32
FIXED_SIZE_BINARY, BINARYIPv6FIXED_SIZE_BINARY
FIXED_SIZE_BINARY, BINARYInt128/UInt128/Int256/UInt256FIXED_SIZE_BINARY

Arrays can be nested and can have a value of the Nullable type as an argument. Tuple and Map types also can be nested.

The DICTIONARY type is supported for INSERT queries, and for SELECT queries there is an output_format_arrow_low_cardinality_as_dictionary setting that allows to output LowCardinality type as a DICTIONARY type.

Unsupported Arrow data types: FIXED_SIZE_BINARY, JSON, UUID, ENUM.

The data types of ClickHouse table columns do not have to match the corresponding Arrow data fields. When inserting data, ClickHouse interprets data types according to the table above and then casts the data to the data type set for the ClickHouse table column.

Example Usage

Inserting Data

You can insert Arrow data from a file into ClickHouse table by the following command:

$ cat filename.arrow | clickhouse-client --query="INSERT INTO some_table FORMAT Arrow"

Selecting Data

You can select data from a ClickHouse table and save them into some file in the Arrow format by the following command:

$ clickhouse-client --query="SELECT * FROM {some_table} FORMAT Arrow" > {filename.arrow}

Format Settings