Jian Zhang has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/18953 )

Change subject: IMPALA-11565: Support IF NOT EXISTS in alter table add columns 
for kudu table
......................................................................


Patch Set 9:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/18953/9/fe/src/main/java/org/apache/impala/service/KuduCatalogOpExecutor.java
File fe/src/main/java/org/apache/impala/service/KuduCatalogOpExecutor.java:

http://gerrit.cloudera.org:8080/#/c/18953/9/fe/src/main/java/org/apache/impala/service/KuduCatalogOpExecutor.java@511
PS9, Line 511:       if (ifNotExists && col != null) continue;
             :       if (col != null) {
             :         throw new CatalogException(
             :             String.format("Column '%s' in table '%s' already 
exists.",
             :             col.getName(), tbl.getName()));
             :       }
             :       alterTableOptions.addColumn(createColumnSchema(column, 
false));
             :       hasColumnsAdded = true;
maybe the following refactoring is easier to read and understand:

if (col == null) {
  alterTableOptions.addColumn(createColumnSchema(column, false));
  hasColumnsAdded = true;

} else if (!ifNotExists) {
  throw new CatalogException(
    String.format("Column '%s' in table '%s' already exists.",
    col.getName(), tbl.getName()));
}



--
To view, visit http://gerrit.cloudera.org:8080/18953
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I82590e5372e881f2e81d4ed3dd0d32a2d3ddb517
Gerrit-Change-Number: 18953
Gerrit-PatchSet: 9
Gerrit-Owner: Baike Xia <[email protected]>
Gerrit-Reviewer: Baike Xia <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jian Zhang <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Comment-Date: Sun, 09 Oct 2022 10:54:06 +0000
Gerrit-HasComments: Yes

Reply via email to