You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the Partitioned (PrimaryKey/Log) Table is created, you need first manually create the corresponding partition using the [Add Partition](engine-flink/ddl.md#add-partition) statement
139
-
before you write/read data into this partition.
137
+
:::info
138
+
Fluss partitioned table supports dynamic partition creation, which means you can write data into a partition without pre-creating it.
139
+
You can use the `INSERT INTO` statement to write data into a partitioned table, and Fluss will automatically create the partition if it does not exist.
140
+
See the [Dynamic Partitioning](table-design/data-distribution/partitioning.md#dynamic-partitioning) for more details.
141
+
But you can still use the [Add Partition](engine-flink/ddl.md#add-partition) statement to manually add partitions if needed.
140
142
:::
141
143
144
+
#### Multi-Fields Partitioned Table
145
+
146
+
Fluss also support [Multi-Fields Partitioning](table-design/data-distribution/partitioning.md#multi-field-partitioned-tables), the following SQL statement creates a Multi-Fields Partitioned Log Table in Fluss:
147
+
148
+
```sql title="Flink SQL"
149
+
CREATETABLEmy_multi_fields_part_log_table (
150
+
order_id BIGINT,
151
+
item_id BIGINT,
152
+
amount INT,
153
+
address STRING,
154
+
dt STRING,
155
+
nation STRING
156
+
) PARTITIONED BY (dt, nation);
157
+
```
158
+
142
159
#### Auto partitioned (PrimaryKey/Log) table
143
160
144
161
Fluss also support creat Auto Partitioned (PrimaryKey/Log) Table. The following SQL statement creates an Auto Partitioned PrimaryKey Table in Fluss.
For more details about Auto Partitioned (PrimaryKey/Log) Table, refer to [Auto Partitioning](table-design/data-distribution/partitioning.md#auto-partitioning).
178
195
196
+
179
197
### Options
180
198
181
199
The supported option in `WITH` parameters when creating a table are listed in [Connector Options](engine-flink/options.md) page.
@@ -223,11 +241,17 @@ To show all the partitions of a partitioned table, run:
223
241
SHOW PARTITIONS my_part_pk_table;
224
242
```
225
243
226
-
For more details, refer to the [Flink SHOW PARTITIONS](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/show/#show-partitions) documentation.
244
+
For multi-field partitioned tables, you can use the `SHOW PARTITIONS` command with either **partial** or **full** partition field conditions to list matching partitions.
227
245
228
-
:::note
229
-
Currently, we only support show all partitions of a partitioned table, but not support show partitions with the given partition spec.
230
-
:::
246
+
```sql title="Flink SQL"
247
+
-- Show partitions using a partial partition filter
248
+
SHOW PARTITIONS my_multi_fields_part_log_table PARTITION (dt ='2025-03-05');
249
+
250
+
-- Show partitions using a full partition filter
251
+
SHOW PARTITIONS my_multi_fields_part_log_table PARTITION (dt ='2025-03-05', nation ='US');
252
+
```
253
+
254
+
For more details, refer to the [Flink SHOW PARTITIONS](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/show/#show-partitions) documentation.
231
255
232
256
## Add Partition
233
257
@@ -237,7 +261,11 @@ or throw an exception.
237
261
238
262
To add partitions, run:
239
263
```sql title="Flink SQL"
264
+
-- Add a partition to a single field partitioned table
For more details, refer to the [Flink ALTER TABLE(ADD)](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/alter/#add) documentation.
@@ -250,7 +278,11 @@ not exists, Fluss will ignore the request or throw an exception.
250
278
251
279
To drop partitions, run:
252
280
```sql title="Flink SQL"
281
+
-- Drop a partition from a single field partitioned table
253
282
ALTERTABLE my_part_pk_table DROP PARTITION (dt ='2025-03-05');
283
+
284
+
-- Drop a partition from a multi-field partitioned table
285
+
ALTERTABLE my_multi_fields_part_log_table DROP PARTITION (dt ='2025-03-05', nation ='US');
254
286
```
255
287
256
288
For more details, refer to the [Flink ALTER TABLE(DROP)](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/alter/#drop) documentation.
0 commit comments