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



##########
File path: 
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java
##########
@@ -164,8 +175,58 @@ public JdbcQueryEventHandlerImpl(QueryProcessor processor, 
JdbcMetadataCatalog m
     /** {@inheritDoc} */
     @Override
     public CompletableFuture<BatchExecuteResult> 
batchAsync(BatchExecuteRequest req) {
-        return CompletableFuture.completedFuture(new 
BatchExecuteResult(UNSUPPORTED_OPERATION,
-                "ExecuteBatch operation is not implemented yet."));
+        IntList res = new IntArrayList();
+
+        IgniteBiTuple<Integer, String> firstError = new IgniteBiTuple<>();
+        try {
+            for (Query query : req.queries()) {
+                if (query.args() == null) {
+                    executeAndCollectUpdateResult(req, res, query, 
OBJECT_EMPTY_ARRAY, firstError);
+                } else {
+                    for (Object[] arg : query.args()) {
+                        executeAndCollectUpdateResult(req, res, query, arg, 
firstError);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            StringWriter sw = getWriterWithStackTrace(e);
+
+            return CompletableFuture.completedFuture(new 
BatchExecuteResult(Response.STATUS_FAILED,
+                    "Exception while executing query " + 
req.queries().get(0).sql() + ". Error message: " + sw));
+        }
+
+        if (!firstError.isEmpty()) {
+            return CompletableFuture.completedFuture(new BatchExecuteResult(

Review comment:
       How to understand what query from the batch has failed if the 'res' 
contains results for all of the queries?




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