tencent cloud

ClickHouse Sinks
Last updated:2023-11-08 16:20:02
ClickHouse Sinks
Last updated: 2023-11-08 16:20:02

Overview

A ClickHouse data sink can write data to ClickHouse.
Note
The engine of ClickHouse data sink tables must be CollapsingMergeTree.

Mapping of common data types

For the data types supported by ClickHouse, see ClickHouse Data ‍Types. The table below lists some of the common data types and their counterparts in Flink.
Flink
ClickHouse
VARCHAR
String/FixedString(N)
STRING
String/FixedString(N)
BOOLEAN
There isn't a dedicated ClickHouse type for boolean. You can use UInt8 to store boolean data, limiting the valid values to 0 and 1, or use the string type, limiting the valid values to true and false.
DECIMAL
Decimal32(S)/Decimal64(S)/Decimal128(S)
TINYINT
Int8
SMALLINT
Int16
INTEGER
Int32
BIGINT
Int64
FLOAT
Float32
DOUBLE
Float64
DATE
Date
TIMESTAMP
DateTime
TIMESTAMP WITH LOCAL TIME ZONE
DateTime. Example: DateTime64(3, 'Asia/Shanghai').

Notes

Primary key

‍To ensure that update and delete operations are synced as expected, make sure you define the primary key correctly using the CREATE TABLE statement.

Collapsed fields

The CollapsingMergeTree engine of ClickHouse adds the logic of rows collapsing to data parts merge algorithm. You can specify collapsed fields using ENGINE = CollapsingMergeTree(Sign) when creating a table. ‍To learn more, see the ClickHouse document.

WITH parameters

ClickHouse data sinks are developed based on the data warehouse ClickHouse. The two have identical WITH parameters. For details, see ClickHouse.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback