anton-vinogradov commented on a change in pull request #9407:
URL: https://github.com/apache/ignite/pull/9407#discussion_r714954416



##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryAliasTest.java
##########
@@ -53,6 +56,23 @@
     /** */
     private static final int CNT = 10_000;
 
+    /** Query index, {@code null} or index name. */
+    @Parameterized.Parameter
+    public String qryIdx;
+
+    /** Query desc index, {@code null} or index name. */
+    @Parameterized.Parameter(1)
+    public String qryDescIdx;
+
+    /** */
+    @Parameterized.Parameters(name = "qryIdx={0}")

Review comment:
       looks like the second param is also important :)

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/IndexQueryProcessor.java
##########
@@ -148,6 +161,55 @@ private Index indexByName(GridCacheContext<?, ?> cctx, 
IndexQueryDesc idxQryDesc
         return idxProc.index(origIdxName);
     }
 
+    /**
+     * Get index by list of fields to query, or return {@code null}.
+     */
+    private Index indexByCriteria(GridCacheContext<?, ?> cctx, IndexQueryDesc 
idxQryDesc, String tableName) {
+        Collection<Index> idxs = idxProc.indexes(cctx);
+
+        // Check both fields (original and normalized).
+        final Set<String> critFields = idxQryDesc.criteria().stream()
+            .map(IndexQueryCriterion::field)
+            .flatMap(f -> Stream.of(f, QueryUtils.normalizeObjectName(f, 
false)))
+            .collect(Collectors.toSet());
+
+        for (Index i: idxs) {

Review comment:
       idx

##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryQueryEntityTest.java
##########
@@ -61,6 +62,23 @@
     /** */
     private static final int CNT = 10_000;
 
+    /** Query index, {@code null} or index name. */
+    @Parameterized.Parameter
+    public String qryIdx;
+
+    /** Query desc index, {@code null} or index name. */
+    @Parameterized.Parameter(1)
+    public String qryDescIdx;
+
+    /** */
+    @Parameterized.Parameters(name = "qryIdx={0}")

Review comment:
       looks like the second param is also important :)

##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryQueryEntityTest.java
##########
@@ -113,44 +131,46 @@
     /** */
     @Test
     public void testEmptyCache() {
-        IndexQuery<Long, Person> qry = new IndexQuery<Long, 
Person>(Person.class, ID_IDX)
+        IndexQuery<Long, Person> qry = new IndexQuery<Long, 
Person>(Person.class, qryIdx)
             .setCriteria(lt("id", Integer.MAX_VALUE));
 
         assertTrue(cache.query(qry).getAll().isEmpty());
 
-        qry = new IndexQuery<Long, Person>(Person.class, DESC_ID_IDX)
+        qry = new IndexQuery<Long, Person>(Person.class, qryDescIdx)
             .setCriteria(lt("descId", Integer.MAX_VALUE));
 
         assertTrue(cache.query(qry).getAll().isEmpty());
 
-        // Wrong fields in query.
-        GridTestUtils.assertThrows(null, () -> {
-            IndexQuery<Long, Person> wrongQry = new IndexQuery<Long, 
Person>(Person.class, DESC_ID_IDX)
-                .setCriteria(lt("id", Integer.MAX_VALUE));
+        if (qryIdx != null) {

Review comment:
       any reason for this `if`?

##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQuerySqlIndexTest.java
##########
@@ -57,6 +62,16 @@
     /** */
     private static final int CNT = 10_000;
 
+    /** Query index, {@code null} of index name. */
+    @Parameterized.Parameter()
+    public String qryIdxName;

Review comment:
       should this be qryDescIdx?

##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryRangeTest.java
##########
@@ -253,8 +253,8 @@ public void checkRangeQueries() {
     /** */
     public void checkRangeDescQueries() {
         // Query empty cache.
-        IndexQuery<Long, Person> qry = new IndexQuery<Long, 
Person>(Person.class, IDX)
-            .setCriteria(lt("id", Integer.MAX_VALUE));
+        IndexQuery<Long, Person> qry = new IndexQuery<Long, 
Person>(Person.class, DESC_IDX)
+            .setCriteria(lt("descId", Integer.MAX_VALUE));

Review comment:
       any reason for this change?

##########
File path: 
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryQueryEntityTest.java
##########
@@ -38,6 +38,7 @@
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
+import org.junit.runners.Parameterized;

Review comment:
       @RunWith(Parameterized.class) missed




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