JingsongLi commented on code in PR #230:
URL: https://github.com/apache/flink-table-store/pull/230#discussion_r926433884
##########
docs/content/docs/engines/spark.md:
##########
@@ -88,22 +88,103 @@ OPTIONS (
SELECT * FROM table_store.default.myTable;
```
-## DDL
+## DDL Statements
-`ALTER TABLE ... SET TBLPROPERTIES`
+### Create Table
```sql
-ALTER TABLE table_store.default.myTable SET TBLPROPERTIES (
+CREATE TABLE [IF NOT EXISTS] table_identifier
+[ ( col_name1[:] col_type1 [ COMMENT col_comment1 ], ... ) ]
+[ COMMENT table_comment ]
+[ PARTITIONED BY ( col_name1, col_name2, ... ) ]
+[ TBLPROPERTIES ( key1=val1, key2=val2, ... ) ]
+```
+For example, create an order table with `order_id` as primary key and
partitioned by `dt, hh`.
+```sql
+CREATE TABLE table_store.default.OrderTable (
+ order_id BIGINT NOT NULL comment 'biz order id',
+ buyer_id BIGINT NOT NULL COMMENT 'buyer id',
+ coupon_info ARRAY<STRING> NOT NULL COMMENT 'coupon info',
+ order_amount DOUBLE NOT NULL COMMENT 'order amount',
+ dt STRING NOT NULL COMMENT 'yyyy-MM-dd',
+ hh STRING NOT NULL COMMENT 'HH'
+) COMMENT 'my table'
+PARTITIONED BY (dt, hh)
+TBLPROPERTIES ('foo' = 'bar', 'primary-key' = 'order_id, dt, hh')
+```
+{{< hint info >}}
+__Note:__
+- Primary key feature is supported via table properties, and composite primary
key is delimited with comma.
+- Partition fields should be predefined, complex partition such like
`PARTITIONED BY ( col_name2[:] col_type2 [ COMMENT col_comment2 ], ... )` is
not supported.
+{{< /hint >}}
+
+### Alter Table
+```sql
+ALTER TABLE table_identifier
+SET TBLPROPERTIES ( key1=val1 )
+ | RESET TBLPROPERTIES (key2)
+ | ADD COLUMNS ( col_name col_type [ , ... ] )
+ | { ALTER | CHNAGE } COLUMN col_name { DROP NOT NULL | COMMENT
'new_comment'}
+```
+
+- Change/add table properties
+```sql
+ALTER TABLE table_store.default.OrderTable SET TBLPROPERTIES (
'write-buffer-size'='256 MB'
)
```
-`ALTER TABLE ... UNSET TBLPROPERTIES`
+- Remove a table property
```sql
-ALTER TABLE table_store.default.myTable UNSET TBLPROPERTIES
('write-buffer-size')
+ALTER TABLE table_store.default.OrderTable UNSET TBLPROPERTIES
('write-buffer-size')
```
-`ALTER TABLE ... ADD COLUMN`
+- Add a new column
```sql
-ALTER TABLE table_store.default.myTable
-ADD COLUMNS (new_column STRING)
+ALTER TABLE table_store.default.OrderTable ADD COLUMNS (buy_count INT)
```
+
+- Change column type
+```sql
+ALTER TABLE table_store.default.OrderTable ALTER COLUMN buy_count BIGINT
Review Comment:
Don't add this to documentation, it has some risks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]