You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/10/17 07:01:12 UTC

[GitHub] [doris] liaoxin01 opened a new pull request, #13410: [feature](alter) support rename column for table with unique column id

liaoxin01 opened a new pull request, #13410:
URL: https://github.com/apache/doris/pull/13410

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #13410:
URL: https://github.com/apache/doris/pull/13410#issuecomment-1285242413

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] liaoxin01 commented on pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
liaoxin01 commented on PR #13410:
URL: https://github.com/apache/doris/pull/13410#issuecomment-1284846328

   > We should change meta version and add tests for mv.
   
   mv test has been added.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] yiguolei merged pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #13410:
URL: https://github.com/apache/doris/pull/13410


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] dataroaring commented on a diff in pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
dataroaring commented on code in PR #13410:
URL: https://github.com/apache/doris/pull/13410#discussion_r999365287


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4030,12 +4031,113 @@ public void replayRenamePartition(TableInfo tableInfo) throws MetaNotFoundExcept
         }
     }
 
+    public void renameColumn(Database db, OlapTable table, String colName,
+            String newColName, boolean isReplay) throws DdlException {
+        if (table.getState() != OlapTableState.NORMAL) {
+            throw new DdlException("Table[" + table.getName() + "] is under " + table.getState());
+        }
+
+        if (colName.equalsIgnoreCase(newColName)) {
+            throw new DdlException("Same column name");
+        }
+
+        Map<Long, MaterializedIndexMeta> indexIdToMeta = table.getIndexIdToMeta();
+        for (Map.Entry<Long, MaterializedIndexMeta> entry : indexIdToMeta.entrySet()) {
+            // rename column is not implemented for table without column unique id.
+            if (entry.getValue().getMaxColUniqueId() < 0) {
+                throw new DdlException("not implemented for table without column unique id");

Review Comment:
   same as before, users do not know what is column unique id, they know property in create table statement.



##########
docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-RENAME.md:
##########
@@ -66,6 +66,18 @@ grammar:
 RENAME PARTITION old_partition_name new_partition_name;
 ```
 
+4. Modify the column name
+
+grammar:
+
+```sql
+RENAME COLUMN old_column_name new_column_name;
+```
+
+Notice:
+- Currently only tables with column unique id are supported
+

Review Comment:
   Currently only tables with column unique id are supported, which are created with property 'light_schema_change'.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] dataroaring commented on a diff in pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
dataroaring commented on code in PR #13410:
URL: https://github.com/apache/doris/pull/13410#discussion_r999365287


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4030,12 +4031,113 @@ public void replayRenamePartition(TableInfo tableInfo) throws MetaNotFoundExcept
         }
     }
 
+    public void renameColumn(Database db, OlapTable table, String colName,
+            String newColName, boolean isReplay) throws DdlException {
+        if (table.getState() != OlapTableState.NORMAL) {
+            throw new DdlException("Table[" + table.getName() + "] is under " + table.getState());
+        }
+
+        if (colName.equalsIgnoreCase(newColName)) {
+            throw new DdlException("Same column name");
+        }
+
+        Map<Long, MaterializedIndexMeta> indexIdToMeta = table.getIndexIdToMeta();
+        for (Map.Entry<Long, MaterializedIndexMeta> entry : indexIdToMeta.entrySet()) {
+            // rename column is not implemented for table without column unique id.
+            if (entry.getValue().getMaxColUniqueId() < 0) {
+                throw new DdlException("not implemented for table without column unique id");

Review Comment:
   same as above, users do not know what is column unique id, they know property in create table statement.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] hello-stephen commented on pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #13410:
URL: https://github.com/apache/doris/pull/13410#issuecomment-1285633491

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 41.28 seconds
    load time: 596 seconds
    storage size: 17154743846 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221020222044_clickbench_pr_31967.html


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #13410: [feature](alter) support rename column for table with unique column id

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #13410:
URL: https://github.com/apache/doris/pull/13410#issuecomment-1285242468

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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