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
Copy file name to clipboardExpand all lines: fluss-connectors/fluss-connector-flink/src/main/java/com/alibaba/fluss/connector/flink/catalog/FlinkCatalog.java
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -427,6 +427,8 @@ public List<CatalogPartitionSpec> listPartitions(
Copy file name to clipboardExpand all lines: fluss-connectors/fluss-connector-flink/src/test/java/com/alibaba/fluss/connector/flink/catalog/FlinkCatalogITCase.java
Copy file name to clipboardExpand all lines: website/docs/engine-flink/ddl.md
+79-6Lines changed: 79 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,13 +88,13 @@ CREATE TABLE my_log_table (
88
88
89
89
### Partitioned (PrimaryKey/Log) Table
90
90
91
-
The following SQL statement creates a Partitioned PrimaryKey Table in Fluss. Note that the partitioned field (`dt` in this case) must be a subset of the primary key (`dt, shop_id, user_id` in this case).
92
-
Currently, Fluss only supports one partitioned field with `STRING` type.
93
-
94
91
:::note
95
-
Currently, partitioned table must enable auto partition and set auto partition time unit.
92
+
1. Currently, Fluss only supports one partitioned field with `STRING` type
93
+
2. For the Partitioned PrimaryKey Table, the partitioned field (`dt` in this case) must be a subset of the primary key (`dt, shop_id, user_id` in this case)
96
94
:::
97
95
96
+
The following SQL statement creates a Partitioned PrimaryKey Table in Fluss.
The following SQL statement creates a Partitioned Log Table in Fluss.
110
+
111
+
```sql title="Flink SQL"
112
+
CREATETABLEmy_part_log_table (
113
+
order_id BIGINT,
114
+
item_id BIGINT,
115
+
amount INT,
116
+
address STRING,
117
+
dt STRING
118
+
) PARTITIONED BY (dt);
119
+
```
120
+
:::note
121
+
After the Partitioned (PrimaryKey/Log) Table is created, you need first manually create the corresponding partition using the [Add Partition](/docs/engine-flink/ddl.md#add-partition) statement
122
+
before you write/read data into this partition.
123
+
:::
124
+
125
+
#### Auto partitioned (PrimaryKey/Log) table
126
+
127
+
Fluss also support creat Auto Partitioned (PrimaryKey/Log) Table. The following SQL statement creates an Auto Partitioned PrimaryKey Table in Fluss.
128
+
129
+
```sql title="Flink SQL"
130
+
CREATETABLEmy_auto_part_pk_table (
131
+
dt STRING,
132
+
shop_id BIGINT,
133
+
user_id BIGINT,
134
+
num_orders INT,
135
+
total_amount INT,
136
+
PRIMARY KEY (dt, shop_id, user_id) NOT ENFORCED
106
137
) PARTITIONED BY (dt) WITH (
107
138
'bucket.num'='4',
108
139
'table.auto-partition.enabled'='true',
109
140
'table.auto-partition.time-unit'='day'
110
141
);
111
142
```
112
143
113
-
The following SQL statement creates a Partitioned Log Table in Fluss.
144
+
The following SQL statement creates an Auto Partitioned Log Table in Fluss.
For more details about Auto Partitioned (PrimaryKey/Log) Table, refer to [Auto Partitioning Options](/docs/table-design/data-distribution/partitioning/#auto-partitioning-options).
161
+
162
+
### Options
129
163
130
164
The supported option in "with" parameters when creating a table are as follows:
131
165
@@ -172,4 +206,43 @@ DROP TABLE my_table;
172
206
173
207
This will entirely remove all the data of the table in the Fluss cluster.
174
208
209
+
## Show Partitions
210
+
211
+
To show all the partitions of a partitioned table, run:
212
+
```sql title="Flink SQL"
213
+
SHOW PARTITIONS my_part_pk_table;
214
+
```
215
+
216
+
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.
217
+
218
+
:::note
219
+
Currently, we only support show all partitions of a partitioned table, but not support show partitions with the given partition spec.
220
+
:::
221
+
222
+
## Add Partition
223
+
224
+
Fluss support manually add partitions to an exists partitioned table by Fluss Catalog. If the specified partition
225
+
not exists, Fluss will create the partition. If the specified partition already exists, Fluss will ignore the request
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.
234
+
235
+
## Drop Partition
236
+
237
+
Fluss also support manually drop partitions from an exists partitioned table by Fluss Catalog. If the specified partition
238
+
not exists, Fluss will ignore the request or throw an exception.
239
+
240
+
241
+
To drop partitions, run:
242
+
```sql title="Flink SQL"
243
+
ALTERTABLE my_part_pk_table DROP PARTITION (dt ='2025-03-05');
244
+
```
245
+
246
+
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.
Copy file name to clipboardExpand all lines: website/docs/table-design/data-distribution/partitioning.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,10 @@ sidebar_position: 2
7
7
## Partitioned Tables
8
8
In Fluss, a **Partitioned Table** organizes data based on one or more partition keys, providing a way to improve query performance and manageability for large datasets. Partitions allow the system to divide data into distinct segments, each corresponding to specific values of the partition keys.
9
9
10
-
For partitioned tables, Fluss supports auto partitioning creation. Partitions can be automatically created based on the auto partitioning rules configured at the time of table creation, and expired partitions are automatically removed, ensuring data not expanding unlimited.
10
+
For partitioned tables, Fluss not only supports manage partitions by users, like create/drop partitions, but also supports automatic manage partitions.
11
+
- For manually managing partitions, user can create new partitions or drop exists partitions. Learn how to create or drop partitions please refer to [Add Partition](/docs/engine-flink/ddl.md#add-partition) and [Drop Partition](/docs/engine-flink/ddl.md#drop-partition).
12
+
- For automatically managing partitions, the partitions will be created based on the auto partitioning rules configured at the time of table creation, and expired partitions are automatically removed, ensuring data not expanding unlimited. See [Auto Partitioning Options](/docs/table-design/data-distribution/partitioning.md#auto-partitioning-options).
13
+
- Manual management and automated management are orthogonal and can coexist on the same table
11
14
12
15
### Key Benefits of Partitioned Tables
13
16
-**Improved Query Performance:** By narrowing down the query scope to specific partitions, the system reads fewer data, reducing query execution time.
0 commit comments