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

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


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

commit 68e1cfa381c5868b5fd9c662e6169bb9f9bef939
Author: jiafeng.zhang <zhang...@gmail.com>
AuthorDate: Tue Oct 11 14:45:51 2022 +0800

    [typo](docs)Modification instructions and examples for adding schema change 
key columns
    
    [typo](docs)Modification instructions and examples for adding schema change 
key columns
---
 docs/advanced/alter-table/schema-change.md         | 39 ++++++++++++++++++++++
 .../Alter/ALTER-TABLE-COLUMN.md                    |  6 ++++
 .../current/advanced/alter-table/schema-change.md  | 39 ++++++++++++++++++++++
 .../Alter/ALTER-TABLE-COLUMN.md                    |  6 ++++
 4 files changed, 90 insertions(+)

diff --git a/docs/advanced/alter-table/schema-change.md 
b/docs/advanced/alter-table/schema-change.md
index e5e4a6465f5..43488665a24 100644
--- a/docs/advanced/alter-table/schema-change.md
+++ b/docs/advanced/alter-table/schema-change.md
@@ -171,6 +171,45 @@ 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.
+
+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     |       |
++-----------+-------+-------------+------+------+---------+-------+
+```
+
+
+
 ## Notice
 
 * Only one Schema Change job can be running on a table at a time.
diff --git 
a/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
 
b/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
index 697ef2a912b..308ede9f649 100644
--- 
a/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
+++ 
b/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
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+````
+
 ### Keywords
 
 ```text
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/advanced/alter-table/schema-change.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/advanced/alter-table/schema-change.md
index dfee8198417..bbf6614ff67 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/advanced/alter-table/schema-change.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/advanced/alter-table/schema-change.md
@@ -181,6 +181,45 @@ ADD COLUMN k5 INT default "1" to rollup2;
 
 同时,不允许向 Rollup 中加入 Base 表已经存在的列。如果用户需要这样做,可以重新建立一个包含新增列的 Rollup,之后再删除原 Rollup。
 
+### 修改 Key 列
+
+修改表的 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 Change 作业在运行。
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
index 287ca8a3f3b..c796eb1feff 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-COLUMN.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/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. 修改 Key 列的某个字段的长度
+
+```sql
+alter table example_tbl modify column k3 varchar(50) key null comment 'to 50'
+```
+
 ### Keywords
 
 ```text


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

Reply via email to