Skip to content

Commit acff1d7

Browse files
authored
[docs] Add show partitions by given partition spec ddl in ddl.md (#1093)
1 parent ae67d1a commit acff1d7

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

website/docs/engine-flink/ddl.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,28 @@ CREATE TABLE my_part_log_table (
134134
dt STRING
135135
) PARTITIONED BY (dt);
136136
```
137-
:::note
138-
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.
140142
:::
141143

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+
CREATE TABLE my_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+
142159
#### Auto partitioned (PrimaryKey/Log) table
143160

144161
Fluss also support creat Auto Partitioned (PrimaryKey/Log) Table. The following SQL statement creates an Auto Partitioned PrimaryKey Table in Fluss.
@@ -176,6 +193,7 @@ CREATE TABLE my_auto_part_log_table (
176193

177194
For more details about Auto Partitioned (PrimaryKey/Log) Table, refer to [Auto Partitioning](table-design/data-distribution/partitioning.md#auto-partitioning).
178195

196+
179197
### Options
180198

181199
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:
223241
SHOW PARTITIONS my_part_pk_table;
224242
```
225243

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.
227245

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.
231255

232256
## Add Partition
233257

@@ -237,7 +261,11 @@ or throw an exception.
237261

238262
To add partitions, run:
239263
```sql title="Flink SQL"
264+
-- Add a partition to a single field partitioned table
240265
ALTER TABLE my_part_pk_table ADD PARTITION (dt = '2025-03-05');
266+
267+
-- Add a partition to a multi-field partitioned table
268+
ALTER TABLE my_multi_fields_part_log_table ADD PARTITION (dt = '2025-03-05', nation = 'US');
241269
```
242270

243271
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.
250278

251279
To drop partitions, run:
252280
```sql title="Flink SQL"
281+
-- Drop a partition from a single field partitioned table
253282
ALTER TABLE my_part_pk_table DROP PARTITION (dt = '2025-03-05');
283+
284+
-- Drop a partition from a multi-field partitioned table
285+
ALTER TABLE my_multi_fields_part_log_table DROP PARTITION (dt = '2025-03-05', nation = 'US');
254286
```
255287

256288
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.

website/docs/engine-flink/reads.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ CREATE TABLE `testcatalog`.`testdb`.`log_partitioned_table` (
115115
`c_custkey` INT NOT NULL,
116116
`c_name` STRING NOT NULL,
117117
`c_address` STRING NOT NULL,
118-
`c_nationkey` INT NOT NULL,
118+
`c_nationkey` STRING NOT NULL,
119119
`c_phone` STRING NOT NULL,
120120
`c_acctbal` DECIMAL(15, 2) NOT NULL,
121121
`c_mktsegment` STRING NOT NULL,

0 commit comments

Comments
 (0)