Github user qiuchenjian commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/3044#discussion_r244676690
--- Diff: docs/ddl-of-carbondata.md ---
@@ -681,24 +682,28 @@ Users can specify which columns to include and
exclude for local dictionary gene
**NOTE:** Drop Complex child column is not supported.
- - ##### CHANGE DATA TYPE
+ - ##### RENAME COLUMN AND CHANGE DATATYPE
- This command is used to change the data type from INT to BIGINT or
decimal precision from lower to higher.
+ This command is used to change the data type from INT to BIGINT or
decimal precision from lower to higher and rename column.
Change of decimal data type from lower precision to higher precision
will only be supported for cases where there is no data loss.
```
- ALTER TABLE [db_name.]table_name CHANGE col_name col_name
changed_column_type
+ ALTER TABLE [db_name.]table_name CHANGE old_col_name new_col_name
column_data_type
```
+ Scenarios:
+ - If both the old and new column name are same, it is just a datatype
change operation
+ - If the old column name and new column name are different and
datatype is column's source datatype, it is just a column rename operation else
it is both column rename and
+ datatype change operation.
Valid Scenarios
- Invalid scenario - Change of decimal precision from (10,2) to
(10,5) is invalid as in this case only scale is increased but total number of
digits remains the same.
- Valid scenario - Change of decimal precision from (10,2) to (12,3)
is valid as the total number of digits are increased by 2 but scale is
increased only by 1 which will not lead to any data loss.
- **NOTE:** The allowed range is 38,38 (precision, scale) and is a
valid upper case scenario which is not resulting in data loss.
- Example1:Changing data type of column a1 from INT to BIGINT.
+ Example1:Rename column a1 to a2 and changing data type from INT to
BIGINT.
--- End diff --
```suggestion
Example1:Rename column a1 to a2 and change data type from INT to
BIGINT.
```
---