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/01/12 15:29:32 UTC

[GitHub] [ignite-3] ibessonov commented on a change in pull request #545: IGNITE-16281 Fix deadlock

ibessonov commented on a change in pull request #545:
URL: https://github.com/apache/ignite-3/pull/545#discussion_r783181818



##########
File path: modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/JdbcMetadataCatalog.java
##########
@@ -93,24 +93,17 @@ public JdbcMetadataCatalog(IgniteTables tables) {
      *
      * @param schemaNamePtrn Sql pattern for schema name.
      * @param tblNamePtrn    Sql pattern for table name.
-     * @return Collection of primary keys information for tables that matches specified schema and table name patterns.
+     * @return Future of the collection of primary keys information for tables that matches specified schema and table name patterns.
      */
-    public Collection<JdbcPrimaryKeyMeta> getPrimaryKeys(String schemaNamePtrn, String tblNamePtrn) {
-        Collection<JdbcPrimaryKeyMeta> metaSet = new HashSet<>();
-
+    public CompletableFuture<Collection<JdbcPrimaryKeyMeta>> getPrimaryKeys(String schemaNamePtrn, String tblNamePtrn) {
         String schemaNameRegex = translateSqlWildcardsToRegex(schemaNamePtrn);
         String tlbNameRegex = translateSqlWildcardsToRegex(tblNamePtrn);
 
-        tables.tables().stream()
-                .filter(t -> matches(getTblSchema(t.name()), schemaNameRegex))
-                .filter(t -> matches(getTblName(t.name()), tlbNameRegex))
-                .forEach(tbl -> {
-                    JdbcPrimaryKeyMeta meta = createPrimaryKeyMeta(tbl);
-
-                    metaSet.add(meta);
-                });
-
-        return metaSet;
+        return tables.tablesAsync().thenApply(tableList -> tableList.stream()
+            .filter(t -> matches(getTblSchema(t.name()), schemaNameRegex))
+            .filter(t -> matches(getTblName(t.name()), tlbNameRegex))
+            .map(this::createPrimaryKeyMeta)
+            .collect(Collectors.toSet()));

Review comment:
       last parenthesis can be moved to the next line, but it's up to you




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