timoninmaxim commented on code in PR #10316:
URL: https://github.com/apache/ignite/pull/10316#discussion_r1003196935


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/management/SchemaManager.java:
##########
@@ -1086,6 +1087,20 @@ public Collection<TableDescriptor> tablesForCache(String 
cacheName) {
         }
     }
 
+    /**
+     * @param schemaNamePtrn Filter by schema name. Can be {@code null} to 
don't use the filter.
+     * @param tblNamePtrn Filter by table name. Can be {@code null} to don't 
use the filter.
+     *
+     * @return Collection of index descriptors filtered by a given patterns.
+     */
+    public Collection<IndexDescriptor> indexes(String schemaNamePtrn, String 
tblNamePtrn) {

Review Comment:
   Let's filter indexes by patters in `JdbcMetadataInfo`, not here. This logic 
is specific for jdbc connector.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcIndexMeta.java:
##########
@@ -58,26 +60,20 @@ public class JdbcIndexMeta implements JdbcRawBinarylizable {
     }
 
     /**
-     * @param schemaName Schema name.
-     * @param tblName Table name.
-     * @param idx Index info.
+     * @param idx Index descriptor.
      */
-    JdbcIndexMeta(String schemaName, String tblName, GridQueryIndexDescriptor 
idx) {
-        assert tblName != null;
-        assert idx != null;
-        assert idx.fields() != null;
-
-        this.schemaName = schemaName;
-        this.tblName = tblName;
-
+    JdbcIndexMeta(IndexDescriptor idx) {
+        schemaName = idx.table().type().schemaName();
+        tblName = idx.table().type().tableName();
         idxName = idx.name();
+
         type = idx.type();
-        fields = new ArrayList(idx.fields());
 
-        fieldsAsc = new ArrayList<>(fields.size());
+        fields = new ArrayList<>(idx.keyDefinitions().keySet());
 
-        for (int i = 0; i < fields.size(); ++i)
-            fieldsAsc.add(!idx.descending(fields.get(i)));
+        fieldsAsc = idx.keyDefinitions().values().stream()
+            .map(d -> d.order().sortOrder() == SortOrder.ASC)

Review Comment:
   Filling `fields` and `fieldAsc` must be done within single stream. I'm not 
sure that order for `keySet()` and `values()` are guaranteed.



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