
# ADD COLUMNS
#### 功能开启
配置参数：
```
hoodie.schema.evolution.enable=true
```
#### 命令功能
**ADD COLUMNS**命令用于为现有表添加新列。
#### 命令语法
**ALTER TABLE** *tableName* **ADD COLUMNS** *(col_spec\[, col_spec ...\])*
#### 参数描述
表1ADD COLUMNS参数描述 
| 参数        | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|
| tableName | 表名。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| col_spec  | 可由\[col_name\]\[col_type\]\[nullable\]\[comment\]\[col_position\]五部分组成。 - col_name：新增列名，必须指定。 给嵌套列添加新的子列需要指定子列的全名称： - 添加新列col1到STURCT类型嵌套列users struct\<name: string, age: int\>，新列名称需要指定为users.col1。  - 添加新列col1到MAP类型嵌套列memeber map\<string, struct\<n: string, a: int\>\>，新列名称需要指定为member.value.col1。  - 添加新列col2到ARRAY类型嵌套列arraylike array\<struct\<a1: string, a2: int\>\>，新列名称需要指定为arraylike.element.col2。    - col_type：新增列类型，必须指定。  - nullable：新增列是否可以为空，可以缺省。  - comment：新增列comment，可以缺省。  - col_position：列添加位置包括FIRST、AFTER origin_col两种，指定FIRST新增列将会被添加到表的第一列。AFTER origin_col新增列将会被加入到原始列origin_col之后，可以缺省。FIRST只能在嵌套列添加新的子列时使用，禁止top-level列使用FIRST，AFTER没有限制。   |
   
#### 示例
```
alter table h0 add columns(ext0 string);
alter table h0 add columns(new_col int not null comment 'add new column' after col1);
alter table complex_table add columns(col_struct.col_name string comment 'add new column to a struct col' after col_from_col_struct);
```
#### 系统响应
通过运行**DESCRIBE**命令，可显示新添加的列。
