Tanya-W commented on code in PR #19063:
URL: https://github.com/apache/doris/pull/19063#discussion_r1193555260


##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -1833,36 +1902,69 @@ public int getAsInt() {
                     // do nothing, properties are already in propertyMap
                     lightSchemaChange = false;
                 } else if (alterClause instanceof CreateIndexClause) {
-                    if (processAddIndex((CreateIndexClause) alterClause, 
olapTable, newIndexes)) {
+                    CreateIndexClause createIndexClause = (CreateIndexClause) 
alterClause;
+                    IndexDef indexDef = createIndexClause.getIndexDef();
+                    Index index = createIndexClause.getIndex();
+                    if (indexDef.isBuildDeferred()) {
+                        if (!olapTable.isPartitioned()) {
+                            List<String> specifiedPartitions = 
indexDef.getPartitionNames();
+                            if (!specifiedPartitions.isEmpty()) {
+                                throw new DdlException("table " + 
olapTable.getName()
+                                        + " is not partitioned, cannot build 
index with partitions.");
+                            }
+                        }
+                        List<Index> existedIndexes = olapTable.getIndexes();
+                        for (Index existedIdx : existedIndexes) {
+                            if 
(existedIdx.getIndexName().equalsIgnoreCase(indexDef.getIndexName())) {
+                                isBuildInvertedIndex = true;

Review Comment:
   The original intention here is to reuse CreateIndexClause, so not build a 
BuildIndexClause logic. However, using a new BuildIndexClause will make the 
code clearer. I will consider using BuildIndexClause instead



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to