Flink on Iceberg Supporting Dimension Table Join
Scenario
Flink on Iceberg supports dimension table joins, allowing you to enrich real-time streaming data with static or slowly changing dimension data stored in Iceberg.
Notes and Constraints
- By default, a lookup join loads all data in each concurrent. It is applicable only to dimension tables with a small amount of data.
- Lookup join keys do not support complex data types, such as ARRAY, BINARY, DECIMAL, TIME, MAP, or VARIANT.
- Cache refresh does not support incremental read. The entire table is scanned during each refresh.
- The Iceberg dimension table supports only INSERT and UPDATE_AFTER messages.
Parameters
| Key | Default Value | Value Range | Description |
|---|---|---|---|
| lookup.refresh.async | false | true/false | Specifies whether to refresh the cache asynchronously.
|
| lookup.refresh.interval | 1h | Duration (for example, 24 hours) | Interval for refreshing all cached data. |
| lookup.cache.type | AUTO | AUTO / HEAP / ROCKSDB | Cache backend type.
|
| lookup.cache.auto.bytes-threshold | 64 MB | Flink MemorySize (for example, 32 MB) | In AUTO mode, if the table size exceeds this threshold, RocksDB is used. Otherwise, HEAP is used. |
| lookup.cache.max-table-size | 512 MB | Flink MemorySize (for example, 256 MB) | If the size of the Iceberg dimension table exceeds this threshold, the table cannot be loaded. |
| lookup.rocksdb.path | ${java.io.tmpdir}/iceberg-lookup-rocksdb | Valid local directory path. | Data storage path in RocksDB mode. |
Usage
- Create a new Iceberg table, for example, iceberg_catalog.`default`.iceberg_table. The following is a code example:
CREATE TABLE IF NOT EXISTS iceberg_catalog.`default`.iceberg_table ( id BIGINT, data STRING ) PARTITIONED BY (id) WITH ('format-version' = '2'); - SQL example for dimension table join:
CREATE TABLE datagen (id BIGINT) WITH ( 'connector' = 'datagen', 'rows-per-second' = '1' ); CREATE TABLE print WITH ('connector' = 'print') AS SELECT * FROM datagen AS o LEFT JOIN iceberg_catalog.`default`.iceberg_table /*+ OPTIONS('lookup.refresh.interval' = '24h') */ FOR SYSTEM_TIME AS OF PROCTIME () AS d ON o.id = d.id;
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot