You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ibessonov (via GitHub)" <gi...@apache.org> on 2023/10/02 07:18:12 UTC

[GitHub] [ignite-3] ibessonov commented on a diff in pull request #2643: IGNITE-20518 Use CatalogService in JdbcMetadataCatalog

ibessonov commented on code in PR #2643:
URL: https://github.com/apache/ignite-3/pull/2643#discussion_r1342347378


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/jdbc/JdbcMetadataCatalog.java:
##########
@@ -182,28 +202,24 @@ public CompletableFuture<Collection<String>> getSchemasMeta(String schemaNamePtr
             schemas.add(DEFAULT_SCHEMA_NAME);
         }
 
-        return tables.tablesAsync().thenApply(tablesList ->
-                tablesList.stream()
+        return tablesAtNow().thenApply(tables ->
+                tables.stream()
                     .map(tbl -> DEFAULT_SCHEMA_NAME)
                     .filter(schema -> matches(schema, schemaNameRegex))
-                    .collect(Collectors.toCollection(() -> schemas))
+                    .collect(toCollection(() -> schemas))
         );
     }
 
     /**
-     * Creates primary key metadata from table object.
+     * Creates primary key metadata from a table descriptor.
      *
      * @param tbl Table.
      * @return Jdbc primary key metadata.
      */
-    private JdbcPrimaryKeyMeta createPrimaryKeyMeta(Table tbl) {
-        final String keyName = PK + tbl.name();
-
-        SchemaRegistry registry = ((TableImpl) tbl).schemaView();
+    private JdbcPrimaryKeyMeta createPrimaryKeyMeta(CatalogTableDescriptor tbl) {
+        String keyName = PK + tbl.name();
 
-        List<String> keyColNames = Arrays.stream(registry.schema().keyColumns().columns())
-                .map(Column::name)
-                .collect(Collectors.toList());
+        List<String> keyColNames = new ArrayList<>(tbl.primaryKeyColumns());

Review Comment:
   > The pattern is called 'defensive copy', it's widely used.
   
   You know that's bad for performance, right? How hot is this code?



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