Paimon Configuration and Data Types
WITH Parameters
This section describes how to configure parameters for the Flink connector to read and write Paimon tables. By configuring these parameters, you can control the connection and read/write behavior between Flink and Paimon table formats to meet data read/write requirements for various service scenarios.
- Source parameters
Table 1 Source parameters Parameter
Mandatory (Yes/No)
Type
Default Value
Value Range
Description
scan.mode
No
String
default
default/latest-full/latest/compacted-full/from-snapshot/from-snapshot-full/from-timestamp/from-creation-timestamp/incremental
Specifies the read mode. The options are:
- default: Determined by the system automatically.
- latest-full: Emits the latest snapshot first, then continuously reads changes.
- latest: Continuously reads only the latest changes (ignores historical changes).
- compacted-full: Emits the latest compacted snapshot.
- from-snapshot: Starts from a specified snapshot (excluding the initial snapshot).
- from-snapshot-full: Starts from a specified snapshot (including the initial snapshot).
- from-timestamp: Starts from a specified timestamp.
- from-creation-timestamp: Starts from a specified creation timestamp.
- incremental: Reads changes between two snapshots incrementally.
The Flink runtime determines the source data scanning policy and starting position based on this mode, which affects the range of initial read data.
scan.snapshot-id
No
Long
None
Positive integers
Specifies the starting snapshot ID. This parameter is valid only when scan.mode is set to from-snapshot. The Flink runtime starts reading data from the table status corresponding to the snapshot. If the snapshot ID does not exist, the job fails to start.
scan.timestamp-millis
No
Long
None
Timestamps in milliseconds
Specifies the starting timestamp. This parameter is valid only when scan.mode is set to from-timestamp. The Flink runtime starts reading data from the snapshot corresponding to the timestamp and automatically selects the latest snapshot not later than the timestamp as the starting point.
scan.bounded.watermark-interval
No
Duration
None
Positive integers
Specifies the watermark interval for bounded reads. It is used to control the watermark advancement in bounded stream mode. The Flink runtime advances the watermark at this interval. When the watermark exceeds the data range, the source automatically terminates.
lookup.cache.max-rows
No
Integer
None
Positive integers
Specifies the maximum number of rows in the dimension table lookup cache. This parameter applies only to the Lookup JOIN scenarios. The Flink runtime maintains an LRU cache in memory. Once the cached rows reach the upper limit, the least recently accessed records are eliminated. Increasing this value improves the query hit ratio but consumes more memory.
lookup.cache.ttl
No
Duration
None
Positive integers + Time unit
Specifies the time to live (TTL) for the dimension table lookup cache. This parameter applies only to the Lookup JOIN scenarios. The Flink runtime invalidates cached records after they exceed the TTL, and reloads them from the Paimon storage upon next access. This balances data timeliness and query performance.
- Sink parameters
Table 2 Sink parameters Parameter
Mandatory (Yes/No)
Type
Default Value
Value Range
Description
write-mode
No
String
auto
auto/append-only/change-log
Specifies the write mode. The options are:
- auto: Automatically selects a mode based on presence of a primary key.
- append-only: Appends data (no primary key required).
- change-log: Writes change logs (a primary key table is required).
Flink determines the writer type and data processing mode based on this value. In auto mode, it automatically uses change-log if there is a primary key, otherwise append-only.
merge-engine
No
String
deduplicate
deduplicate/partial-update/aggregation/first-row
Specifies the merge engine type. This parameter only applies to primary key tables.
- deduplicate: Retains only the latest records.
- partial-update: Updates partial fields (NULL values do not overwrite non-NULL values).
- aggregation: Updates data based on aggregation functions.
- first-row: Retains the first row after deduplication (DELETE and UPDATE_BEFORE records are not supported).
The Flink runtime determines the merge policy for records with the same primary key based on this engine, which affects the final written data. For streaming queries with partial-update and aggregation, the changelog producers of lookup or full-compaction are required.
write-buffer-size
No
MemorySize
256mb
Positive integers
Sets the size of the write buffer.
The Flink runtime buffers write data in memory and flushes it to disk when the buffer is full. Increasing this value reduces the flushing frequency and improves the write throughput, but increases memory usage.
write.max-writers-per-task
No
Integer
1
Positive integers
Sets the maximum number of writers per task.
The Flink runtime creates the specified number of writers in each sink subtask for parallel writes. A larger value can improve single-task write parallelism but increase memory and file handle consumption.
changelog-producer
No
String
none
none/input/lookup/full-compaction
Specifies the changelog producer mode.
When enabled, complete changelogs are generated for downstream streaming consumption. none indicates that no changelog is generated. input indicates that the input record is directly transferred. lookup indicates that a changelog is generated through lookup. full-compaction indicates that a changelog is generated during full compaction. The Flink runtime generates corresponding changelogs when committing data, which can be consumed incrementally by downstream sources.
sink.parallelism
No
Integer
None
Positive integers
Specifies the parallelism of the sink operator.
If this parameter is not set, the global parallelism of the job is used. The Flink runtime creates the specified number of sink subtasks based on this value. Each subtask is responsible for writing data to a subset of buckets. It is recommended to keep this value consistent with the number of buckets to avoid data skew.
compaction.optimization-enabled
No
Boolean
false
true/false
Specifies whether to enable compaction optimization.
After this function is enabled, Flink automatically merges small files during the writes, reducing files and improving query performance. However, this may increase the computing overhead during writes.
snapshot.time-retained
No
Duration
1h
Positive integers
Set the snapshot retention period.
The Flink runtime automatically cleans up snapshots that exceed this duration to free up storage space. A larger value retains more historical data for incremental reads and time-travel queries, but increases storage consumption.
snapshot.num-retained.min
No
Integer
10
Positive integers
Set the minimum number of snapshots to retain. Even if snapshots exceed the retention duration, at least this number of snapshots will be kept. The Flink runtime uses this value as the lower limit when cleaning up snapshots, ensuring that sufficient snapshots are available for incremental reads.
snapshot.num-retained.max
No
Integer
None
Positive integers
Set the maximum number of snapshots to retain. After this parameter is set, the Flink runtime cleans up the earliest snapshots when the snapshot count exceeds this upper limit, preventing unlimited snapshot growth and storage consumption.
- Sequence field parameters
Table 3 Sequence field parameters Parameter
Mandatory (Yes/No)
Type
Default Value
Value Range
Description
sequence.field
No
String
None
Valid column name
Specifies the sorting field for the primary key table.
Flink determines the order of records based on the value of this field. A larger value indicates a newer record. If this parameter is not specified, the order is determined based on the data arrival time. This is useful for resolving out-of-order records in multi-stream update scenarios.
rowkind.field
No
String
None
Valid column name
Specifies the row type field. The field values can be +I (INSERT), -U (UPDATE_BEFORE), +U (UPDATE_AFTER), or -D (DELETE). The Flink runtime determines the change type of a record based on the value of this field, eliminating the need to rely on Flink's retraction mechanism. This applies to scenarios where change records are directly read from external systems such as Kafka.
- Lookup parameters
Table 4 Lookup parameters Parameter
Mandatory (Yes/No)
Type
Default Value
Value Range
Description
lookup.async
No
Boolean
false
true/false
Determines whether to enable asynchronous lookup.
After this function is enabled, Flink uses an asynchronous thread pool to concurrently query Paimon storage, which significantly improves the throughput of lookup joins but increases memory consumption.
lookup.async-thread-number
No
Integer
16
Positive integers
Specifies the thread pool size for asynchronous lookup.
This parameter is valid only when lookup.async is set to true. The Flink runtime uses this number of threads to concurrently execute lookup queries. A larger value improves the concurrent query capability but increases the memory and CPU usage.
lookup.cache
No
String
AUTO
AUTO / FULL / MEMORY
Specifies the lookup cache mode.
- AUTO: Selected by the system.
- FULL: Full cache (recommended for small tables).
- MEMORY: Memory-only cache.
The Flink runtime determines the caching policy based on this mode. In FULL mode, the entire table data is loaded to the cache during the initial loading, and subsequent queries directly hit the cache.
- Bucketing parameters
Table 5 Bucketing parameters Parameter
Mandatory (Yes/No)
Type
Default Value
Value Range
Description
bucket
No
Integer
-1
-2, -1, or a positive integer
Sets the number of buckets.
- -1 (default): Dynamic bucketing
- -2: Postpone bucketing (for append-only tables)
- A positive integer: A fixed number of buckets.
For primary key tables using fixed bucketing, it is recommended to set this value equal to the Sink parallelism to avoid data skew. The Flink runtime distributes data into corresponding buckets based on the hash value of the bucketing key. The number of buckets affects data distribution balance and parallel read capability.
bucket-key
No
String
Primary key column
Valid column name
Specifies the bucketing key. If not specified, the primary key column is used as the bucketing key. This parameter is valid only for primary key tables. Flink performs bucket routing based on the hash value of this column. Selecting a column with uniform business data distribution as the bucketing key can improve the write and query performance.
Data Type Mapping
| Flink Data Type | Paimon Data Type |
|---|---|
| BOOLEAN | BOOLEAN |
| TINYINT | TINYINT |
| SMALLINT | SMALLINT |
| INT | INT |
| BIGINT | BIGINT |
| FLOAT | FLOAT |
| DOUBLE | DOUBLE |
| DECIMAL | DECIMAL |
| STRING | STRING |
| CHAR | CHAR |
| DATE | DATE |
| TIME | TIME |
| TIMESTAMP | TIMESTAMP |
| TIMESTAMP WITH LOCAL TIMEZONE | TIMESTAMP WITH LOCAL TIMEZONE |
| BINARY | BINARY |
| BYTES | BYTES |
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