xtern commented on code in PR #5143:
URL: https://github.com/apache/ignite-3/pull/5143#discussion_r1939273324


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/fsm/MultiStatementHandler.java:
##########
@@ -141,14 +143,31 @@ CompletableFuture<AsyncSqlCursor<InternalSqlRow>> 
processNext() {
                                 new 
IteratorToDataCursorAdapter<>(Collections.emptyIterator()),
                                 nextCurFut
                         ));
+            } else if (parsedResult.queryType() == SqlQueryType.DDL) {
+                List<ParsedResultWithNextCursorFuture> ddlBatch = new 
ArrayList<>();
+
+                do {
+                    ddlBatch.add(new 
ParsedResultWithNextCursorFuture(scriptStatement.parsedResult, 
scriptStatement.nextStatementFuture));
+
+                    ScriptStatement statement = statements.peek();
+                    if (statement == null || 
statement.parsedResult.queryType() != SqlQueryType.DDL) {
+                        break;
+                    }
+
+                    scriptStatement = statement;
+
+                    statements.poll();
+                } while (true);
+
+                fut = query.executor.executeChildBatch(query, scriptTxContext, 
statementNum, ddlBatch);
             } else {
                 scriptTxContext.registerCursorFuture(parsedResult.queryType(), 
cursorFuture);
 
                 fut = query.executor.executeChildQuery(query, scriptTxContext, 
statementNum, parsedResult, params, nextCurFut);
             }
 
             boolean implicitTx = scriptTxContext.explicitTx() == null;
-
+            ScriptStatement lastProcessedStatement = scriptStatement;

Review Comment:
   maybe something like this would be better?
   
   ```suggestion
               boolean isLastScriptStatement = 
lastProcessedStatement.isLastStatement()
   ```
   :thinking: 



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