Creating a Paimon Append-Only Table
Scenarios
If a table does not have a primary key defined, it is an append-only table by default. Compared to the primary key table, an append-only table does not have the ability to directly receive changelogs. It can only receive incoming data from append operations. This type of table is suitable for use cases that do not require streaming updates.
Syntax Structure
For example, create an append-only table with the partition key pt.
-- SPARK SQL
CREATE TABLE my_table (
id INT,
a STRING,
pt STRING
) TBLPROPERTIES (
'bucket' = '4'
); Append-Only Table Types
| Type | Definition | Description |
|---|---|---|
| Standard Append table (default) | When creating a Paimon append-only table, do not specify a bucket or specify 'bucket' = '-1'. | There is no concept of a bucket. Similar to Hive tables, data files are organized by partition, data can be sorted, and write speeds are faster. Automatic merging of small files is supported. You can also disable automatic merging by setting write-only=true and use an independent compaction task for compression. The read order may not be the same as the write order in streaming mode. It is suitable for scenarios where there are no requirements for the data streaming order. |
| Bucketed append table | When creating a Paimon append-only table, you can set 'bucket' = '<num>' to define the number of buckets. For a non-partitioned table, this sets the total number of buckets to <num>, while for a partitioned table, it defines the number of buckets (<num>) per individual partition. <num> is an integer greater than 0. | By default, the bucket to which each data record belongs is determined by the values of all columns in the data. You can modify the bucketing method by specifying the bucket-key parameter. For example, if 'bucket-key' = 'c1,c2' is configured, Paimon determines the bucket to which each data record belongs based on the values of columns c1 and c2. In streaming mode, records in each bucket are produced in the same order in which data is written to the Paimon table. Specifically:
|
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