You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tk...@apache.org on 2026/03/23 12:47:26 UTC

(ignite) branch ignite-28331 created (now c6a9de50282)

This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a change to branch ignite-28331
in repository https://gitbox.apache.org/repos/asf/ignite.git


      at c6a9de50282 IGNITE-28331 add tests

This branch includes the following new commits:

     new c6a9de50282 IGNITE-28331 add tests

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(ignite) 01/01: IGNITE-28331 add tests

Posted by tk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a commit to branch ignite-28331
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit c6a9de50282412ea9226c54af44780546a70b7ee
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Mon Mar 23 15:47:04 2026 +0300

    IGNITE-28331 add tests
---
 .../calcite/integration/SearchByKeyFieldTest.java  | 89 ++++++++++++++++++++++
 .../ignite/testsuites/IntegrationTestSuite.java    |  4 +-
 2 files changed, 92 insertions(+), 1 deletion(-)

diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SearchByKeyFieldTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SearchByKeyFieldTest.java
new file mode 100644
index 00000000000..e745aa32e2e
--- /dev/null
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SearchByKeyFieldTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.internal.processors.query.calcite.integration;
+
+import java.util.List;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.SqlConfiguration;
+import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
+import org.junit.Test;
+
+/**
+ * Checks that using {@link QueryUtils#KEY_FIELD_NAME} in condition will use
+ * {@link QueryUtils#PRIMARY_KEY_INDEX pk index}.
+ */
+public class SearchByKeyFieldTest extends AbstractBasicIntegrationTest {
+    /** {@inheritDoc} */
+    @Override protected int nodeCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        SqlConfiguration sqlCfg = new SqlConfiguration().setQueryEnginesConfiguration(
+            new CalciteQueryEngineConfiguration().setDefault(true),
+            new IndexingQueryEngineConfiguration()
+        );
+
+        return super.getConfiguration(igniteInstanceName)
+            .setSqlConfiguration(sqlCfg);
+    }
+
+    /** */
+    @Test
+    public void testSimplePk() {
+        sql("create table PUBLIC.PERSON(id int primary key, name varchar, age int)");
+
+        for (int i = 0; i < 10; i++)
+            sql("insert into PUBLIC.PERSON(id, name, age) values (?, ?, ?)", i, "foo" + i, 18 + i);
+
+        List<List<?>> sqlRs = sql("select _key from PUBLIC.PERSON order by id");
+        int _key = (Integer) sqlRs.get(7).get(0);
+        assertEquals(7, _key);
+
+        assertQuery("select id, name, age, _key from PUBLIC.PERSON where _key = ?")
+            .withParams(_key)
+            .matches(QueryChecker.containsIndexScan("PUBLIC", "PERSON", QueryUtils.PRIMARY_KEY_INDEX))
+            .columnNames("ID", "NAME", "AGE", QueryUtils.KEY_FIELD_NAME)
+            .returns(7, "foo7", 25, _key)
+            .check();
+    }
+
+    /** */
+    @Test
+    public void testCompositePk() {
+        sql("create table PUBLIC.PERSON(id int, name varchar, age int, primary key(id, name))");
+
+        for (int i = 0; i < 10; i++)
+            sql("insert into PUBLIC.PERSON(id, name, age) values (?, ?, ?)", i, "foo" + i, 18 + i);
+
+        List<List<?>> sqlRs = sql("select _key from PUBLIC.PERSON order by id");
+        BinaryObject _key = (BinaryObject) sqlRs.get(6).get(0);
+
+        assertQuery("select id, name, age, _key from PUBLIC.PERSON where _key = ?")
+            .withParams(_key)
+            .matches(QueryChecker.containsIndexScan("PUBLIC", "PERSON", QueryUtils.PRIMARY_KEY_INDEX))
+            .columnNames("ID", "NAME", "AGE", QueryUtils.KEY_FIELD_NAME)
+            .returns(6, "foo6", 14, _key)
+            .check();
+    }
+}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
index 9326c647854..33f6162dc04 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
@@ -66,6 +66,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.QueryMeta
 import org.apache.ignite.internal.processors.query.calcite.integration.QueryWithPartitionsIntegrationTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.RunningQueriesIntegrationTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.ScalarInIntegrationTest;
+import org.apache.ignite.internal.processors.query.calcite.integration.SearchByKeyFieldTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.ServerStatisticsIntegrationTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.SetOpIntegrationTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.SortAggregateIntegrationTest;
@@ -174,7 +175,8 @@ import org.junit.runners.Suite;
     QueryEntityValueColumnAliasTest.class,
     CacheStoreTest.class,
     MultiDcQueryMappingTest.class,
-    TxWithExceptionalInterceptorTest.class
+    TxWithExceptionalInterceptorTest.class,
+    SearchByKeyFieldTest.class
 })
 public class IntegrationTestSuite {
 }