You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/06/28 13:42:46 UTC

[GitHub] [ignite-3] vladErmakov07 commented on a diff in pull request #889: IGNITE-16987 Alt alterative version of network refactoring

vladErmakov07 commented on code in PR #889:
URL: https://github.com/apache/ignite-3/pull/889#discussion_r908497836


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryCursorHandlerImpl.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.apache.ignite.internal.jdbc.proto.JdbcQueryCursorHandler;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcColumnMeta;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcMetaColumnsResult;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryCloseRequest;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryCloseResult;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryFetchRequest;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryFetchResult;
+import org.apache.ignite.internal.jdbc.proto.event.JdbcQueryMetadataRequest;
+import org.apache.ignite.internal.jdbc.proto.event.Response;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.util.Commons;
+import org.apache.ignite.lang.IgniteInternalCheckedException;
+import org.apache.ignite.sql.ColumnMetadata;
+import org.apache.ignite.sql.ColumnMetadata.ColumnOrigin;
+import org.apache.ignite.sql.ResultSetMetadata;
+
+/**
+ * Jdbc query event handler implementation.
+ */
+public class JdbcQueryCursorHandlerImpl implements JdbcQueryCursorHandler {
+    /** Client registry resources. */
+    private final ClientResourceRegistry resources;
+
+    /**
+     * Constructor.
+     *
+     * @param resources Client resources.
+     */
+    public JdbcQueryCursorHandlerImpl(ClientResourceRegistry resources) {
+        this.resources = resources;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public CompletableFuture<JdbcQueryFetchResult> fetchAsync(JdbcQueryFetchRequest req) {
+        AsyncSqlCursor<List<Object>> asyncSqlCursor = null;
+        try {
+            asyncSqlCursor = resources.get(req.cursorId()).get(AsyncSqlCursor.class);
+        } catch (IgniteInternalCheckedException e) {
+            return CompletableFuture.completedFuture(new JdbcQueryFetchResult(Response.STATUS_FAILED,
+                    "Failed to find query cursor with ID: " + req.cursorId() + ". " + e));

Review Comment:
   I have reviewed and adjusted all error messages to single pattern: 
   
   > Failed ... [curId=" + req.cursorId()] 
   
   I also fixed wrapping for all exceptions. 
   



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org