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, designed for in-memory random access.
Data types matching
The table below shows the supported data types and how they correspond to ClickHouse data types inINSERT and SELECT queries.
Arrays can be nested and can have a value of the
Nullable type as an argument. Tuple and Map types can also 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. Note that there might be unused values in LowCardinality dictionary, which can lead to unused values in Arrow DICTIONARY during output.
Unsupported Arrow data types:
JSONENUM.
Example usage
In the example below we use theforex dataset available in the
ClickHouse SQL playground.
Selecting data
We select one day ofEUR/USD exchange rates from the playground and save it
into a local forex_eurusd.arrow file. We query the playground over the HTTP
interface, where the host is sql-clickhouse.clickhouse.com and the user is
demo (which has no password):
Reading the file back
We can now read the local Arrow file back withclickhouse-local using the
file table function. The file is
self-describing, so the Arrow format infers the schema automatically:
Response
Inserting data
To load an Arrow file into a ClickHouse table, pipe it intoclickhouse-client
with FORMAT Arrow: