AMashenkov commented on a change in pull request #518:
URL: https://github.com/apache/ignite-3/pull/518#discussion_r799261860



##########
File path: 
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlCommandHandler.java
##########
@@ -237,33 +242,35 @@ private void handleCreateIndex(CreateIndexCommand cmd) {
                 IgniteObjectName.quote(cmd.tableName())
         );
 
-        tableManager.alterTable(fullName, chng -> chng.changeIndices(idxes -> {
-            if (idxes.get(cmd.indexName()) != null) {
-                if (!cmd.ifIndexNotExists()) {
-                    throw new IndexAlreadyExistsException(cmd.indexName());
-                } else {
-                    return;
-                }
+        try {
+            idxManager.createIndex(cmd.indexName(), fullName, idxCh -> 
convert(idx.build(), idxCh));
+        } catch (IndexAlreadyExistsException e) {
+            if (!cmd.ifIndexNotExists()) {
+                throw e;

Review comment:
       Looks like an exception is used for returning the 'result'.
   Is it possible to pass a flag or better have a method createIndexIfNotExists 
?




-- 
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]


Reply via email to