You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/10/11 07:42:22 UTC

[doris] branch master updated: [typo](docs)Modification instructions and examples for adding schema change key columns (#13280)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b42f7e479 [typo](docs)Modification instructions and examples for adding schema change key columns (#13280)
9b42f7e479 is described below

commit 9b42f7e4796b18b9f22d90e8adc32842ba79b024
Author: jiafeng.zhang <zh...@gmail.com>
AuthorDate: Tue Oct 11 15:42:14 2022 +0800

    [typo](docs)Modification instructions and examples for adding schema change key columns (#13280)
---
 docs/en/docs/advanced/alter-table/schema-change.md | 46 ++++++++++++++++++++++
 .../Alter/ALTER-TABLE-COLUMN.md                    |  6 +++
 .../docs/advanced/alter-table/schema-change.md     | 44 +++++++++++++++++++++
 .../Alter/ALTER-TABLE-COLUMN.md                    |  8 ++++
 4 files changed, 104 insertions(+)

diff --git a/docs/en/docs/advanced/alter-table/schema-change.md b/docs/en/docs/advanced/alter-table/schema-change.md
index a7d1fb05d9..03dd656b3f 100644
--- a/docs/en/docs/advanced/alter-table/schema-change.md
+++ b/docs/en/docs/advanced/alter-table/schema-change.md
@@ -171,6 +171,52 @@ When completion, the Schema becomes:
 As you can see, the base table tbl1 also automatically added k4, k5 columns. That is, columns added to any rollup are automatically added to the Base table.
 
 At the same time, columns that already exist in the Base table are not allowed to be added to Rollup. If you need to do this, you can re-create a Rollup with the new columns and then delete the original Rollup.
+
+### Modify Key column
+
+Modifying the Key column of a table is done through the `key` keyword. Let's take a look at an example below.
+
+**This usage is only for the key column of the duplicate key table**
+
+Source Schema :
+
+```text
++-----------+-------+-------------+------+------+---------+-------+
+| IndexName | Field | Type        | Null | Key  | Default | Extra |
++-----------+-------+-------------+------+------+---------+-------+
+| tbl1      | k1    | INT         | No   | true | N/A     |       |
+|           | k2    | INT         | No   | true | N/A     |       |
+|           | k3    | varchar(20) | No   | true | N/A     |       |
+|           | k4    | INT         | No   | false| N/A     |       |
++-----------+-------+-------------+------+------+---------+-------+
+```
+
+The modification statement is as follows, we will change the degree of the k3 column to 50
+
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+````
+
+When done, the Schema becomes:
+
+```text
++-----------+-------+-------------+------+------+---------+-------+
+| IndexName | Field | Type        | Null | Key  | Default | Extra |
++-----------+-------+-------------+------+------+---------+-------+
+| tbl1      | k1    | INT         | No   | true | N/A     |       |
+|           | k2    | INT         | No   | true | N/A     |       |
+|           | k3    | varchar(50) | No   | true | N/A     |       |
+|           | k4    | INT         | No   | false| N/A     |       |
++-----------+-------+-------------+------+------+---------+-------+
+```
+
+Because the Schema Chanage job is an asynchronous operation, only one Schema chanage job can be performed on the same table at the same time. To check the operation status of the job, you can use the following command
+
+```sql
+SHOW ALTER TABLE COLUMN\G;
+````
+
 ## Notice
 
 * Only one Schema Change job can be running on a table at a time.
diff --git a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
index 697ef2a912..a4c106523d 100644
--- a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
+++ b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
@@ -215,6 +215,12 @@ ADD COLUMN v2 INT MAX DEFAULT "0" AFTER k2 TO example_rollup_index,
 ORDER BY (k3,k1,k2,v2,v1) FROM example_rollup_index;
 ```
 
+11. Modify the length of a field in the Key column of the Duplicate key table
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+````
+
 ### Keywords
 
 ```text
diff --git a/docs/zh-CN/docs/advanced/alter-table/schema-change.md b/docs/zh-CN/docs/advanced/alter-table/schema-change.md
index dfee819841..221179f6b8 100644
--- a/docs/zh-CN/docs/advanced/alter-table/schema-change.md
+++ b/docs/zh-CN/docs/advanced/alter-table/schema-change.md
@@ -181,6 +181,50 @@ ADD COLUMN k5 INT default "1" to rollup2;
 
 同时,不允许向 Rollup 中加入 Base 表已经存在的列。如果用户需要这样做,可以重新建立一个包含新增列的 Rollup,之后再删除原 Rollup。
 
+### 修改 Key 列
+
+修改表的 Key 列是通过 `key` 关键字完成,下面我们通过一个例子来看。
+
+**这个用法只针对 Duplicate key 表的 key 列**
+
+源 Schema :
+
+```text
++-----------+-------+-------------+------+------+---------+-------+
+| IndexName | Field | Type        | Null | Key  | Default | Extra |
++-----------+-------+-------------+------+------+---------+-------+
+| tbl1      | k1    | INT         | No   | true | N/A     |       |
+|           | k2    | INT         | No   | true | N/A     |       |
+|           | k3    | varchar(20) | No   | true | N/A     |       |
+|           | k4    | INT         | No   | false| N/A     |       |
++-----------+-------+-------------+------+------+---------+-------+
+```
+
+修改语句如下,我们将 k3 列的程度改成 50
+
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+```
+
+完成后,Schema 变为:
+```text
++-----------+-------+-------------+------+------+---------+-------+
+| IndexName | Field | Type        | Null | Key  | Default | Extra |
++-----------+-------+-------------+------+------+---------+-------+
+| tbl1      | k1    | INT         | No   | true | N/A     |       |
+|           | k2    | INT         | No   | true | N/A     |       |
+|           | k3    | varchar(50) | No   | true | N/A     |       |
+|           | k4    | INT         | No   | false| N/A     |       |
++-----------+-------+-------------+------+------+---------+-------+
+```
+
+因为Schema Chanage 作业是异步操作,同一个表同时只能进行一个Schema chanage 作业,查看作业运行情况,可以通过下面这个命令
+
+```sql
+SHOW ALTER TABLE COLUMN\G;
+```
+
 ## 注意事项
 
 - 一张表在同一时间只能有一个 Schema Change 作业在运行。
diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
index 287ca8a3f3..55047e73cc 100644
--- a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
+++ b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
@@ -215,6 +215,14 @@ ADD COLUMN v2 INT MAX DEFAULT "0" AFTER k2 TO example_rollup_index,
 ORDER BY (k3,k1,k2,v2,v1) FROM example_rollup_index;
 ```
 
+11. 修改Duplicate key 表 Key 列的某个字段的长度
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+```
+
+
+
 ### Keywords
 
 ```text


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org