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/21 05:24:50 UTC

(ignite) branch ignite-28223-add-rowid updated (e9aa9ae6329 -> d5456ad4577)

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

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


    from e9aa9ae6329 IGNITE-28223-add-rowid wip
     new fc725daf8a6 IGNITE-28223-add-rowid wip
     new d5456ad4577 IGNITE-28223-add-rowid wip

The 2 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.


Summary of changes:
 .../calcite/integration/RowIdPseudoColumnTest.java | 60 ++++++++++++++++++++--
 1 file changed, 56 insertions(+), 4 deletions(-)


(ignite) 02/02: IGNITE-28223-add-rowid wip

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

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

commit d5456ad45777fb9dd65e7dc9886b860207a3c09d
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Sat Mar 21 08:24:39 2026 +0300

    IGNITE-28223-add-rowid wip
---
 .../calcite/integration/RowIdPseudoColumnTest.java | 59 ++++++++++++++++++++--
 1 file changed, 55 insertions(+), 4 deletions(-)

diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
index f14f064ab9d..abf07392f40 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
@@ -20,16 +20,25 @@ package org.apache.ignite.internal.processors.query.calcite.integration;
 import java.util.List;
 import org.apache.calcite.adapter.enumerable.NullPolicy;
 import org.apache.calcite.linq4j.tree.Expressions;
+import org.apache.calcite.linq4j.tree.UnaryExpression;
+import org.apache.calcite.sql.SqlBasicCall;
+import org.apache.calcite.sql.SqlCall;
 import org.apache.calcite.sql.SqlFunction;
 import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlIdentifier;
 import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
+import org.apache.calcite.sql.parser.SqlParserPos;
 import org.apache.calcite.sql.type.OperandTypes;
 import org.apache.calcite.sql.type.ReturnTypes;
 import org.apache.calcite.sql.util.ReflectiveSqlOperatorTable;
 import org.apache.calcite.sql.util.SqlOperatorTables;
+import org.apache.calcite.sql.validate.SqlValidator;
 import org.apache.calcite.tools.FrameworkConfig;
 import org.apache.calcite.tools.Frameworks;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.Ignition;
 import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
 import org.apache.ignite.calcite.PseudoColumnDescriptor;
 import org.apache.ignite.calcite.PseudoColumnProvider;
@@ -37,9 +46,14 @@ import org.apache.ignite.calcite.PseudoColumnValueExtractorContext;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.SqlConfiguration;
 import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor;
 import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
+import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
 import org.apache.ignite.internal.processors.query.calcite.exec.exp.RexImpTable;
+import org.apache.ignite.internal.processors.query.calcite.prepare.IgniteSqlCallRewriteTable;
 import org.apache.ignite.plugin.AbstractTestPluginProvider;
 import org.apache.ignite.plugin.PluginContext;
 import org.jetbrains.annotations.Nullable;
@@ -65,13 +79,12 @@ public class RowIdPseudoColumnTest extends AbstractBasicIntegrationTest {
     }
 
     @Test
-    public void name() {
+    public void testSimplePrimaryKey() {
         sql("create table PUBLIC.PERSON(id int primary key, name varchar)");
 
         for (int i = 0; i < 2; i++)
             sql("insert into PUBLIC.PERSON(id, name) values(?, ?)", i, "foo" + i);
 
-        // TODO: IGNITE-28223-add-rowid Вот тут теперь падает и можно дальше двигать
         assertQuery("select id, name, rowid from PUBLIC.PERSON where rowid = '0'")
             .columnNames("ID", "NAME", "ROWID")
             .matches(QueryChecker.containsIndexScan("PUBLIC", "PERSON", "_key_PK"))
@@ -80,7 +93,9 @@ public class RowIdPseudoColumnTest extends AbstractBasicIntegrationTest {
     }
 
     /** */
-    public static @Nullable Integer toKeyFromRowId(@Nullable String rowId) {
+    public static @Nullable Integer toKeyFromRowId(ExecutionContext<?> ctx, @Nullable String rowId) {
+        IgniteEx n = (IgniteEx) Ignition.ignite(ctx.localNodeId());
+
         return rowId == null ? null : Integer.parseInt(rowId);
     }
 
@@ -113,13 +128,49 @@ public class RowIdPseudoColumnTest extends AbstractBasicIntegrationTest {
                 RowIdPseudoColumnOperatorTable.TO_KEY_FROM_ROW_ID,
                 RexImpTable.createRexCallImplementor((translator, call, translatedOperands) -> {
                     var str = Expressions.convert_(translatedOperands.get(0), String.class);
+                    var execCtx = Expressions.convert_(translator.getRoot(), ExecutionContext.class);
 
-                    return Expressions.call(RowIdPseudoColumnTest.class, "toKeyFromRowId", str);
+                    return Expressions.call(RowIdPseudoColumnTest.class, "toKeyFromRowId", execCtx, str);
                 }, NullPolicy.ANY, false)
             );
+
+            IgniteSqlCallRewriteTable.INSTANCE.register(
+                SqlStdOperatorTable.EQUALS.getName(),
+                RowIdPseudoColumnTest::rewriteRowIdEquals
+            );
         }
     }
 
+    /** */
+    private static SqlCall rewriteRowIdEquals(SqlValidator validator, SqlCall call) {
+        List<SqlNode> operands = call.getOperandList();
+
+        if (operands.size() != 2)
+            return call;
+
+        SqlNode left = operands.get(0);
+        SqlNode right = operands.get(1);
+
+        if (!isRowId(left))
+            return call;
+
+        SqlParserPos pos = call.getParserPosition();
+        SqlIdentifier keyId = new SqlIdentifier(QueryUtils.KEY_FIELD_NAME, pos);
+        SqlCall toKey = RowIdPseudoColumnOperatorTable.TO_KEY_FROM_ROW_ID.createCall(pos, right);
+
+        return new SqlBasicCall(SqlStdOperatorTable.EQUALS, List.of(keyId, toKey), pos);
+    }
+
+    /** */
+    private static boolean isRowId(SqlNode node) {
+        if (!(node instanceof SqlIdentifier))
+            return false;
+
+        SqlIdentifier identifier = (SqlIdentifier)node;
+
+        return identifier.names.size() == 1 && "ROWID".equalsIgnoreCase(identifier.getSimple());
+    }
+
     /** */
     public static class RowIdPseudoColumnOperatorTable extends ReflectiveSqlOperatorTable {
         /** */


(ignite) 01/02: IGNITE-28223-add-rowid wip

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

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

commit fc725daf8a616854f406a318412d76f35c79e5f6
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Fri Mar 20 19:34:52 2026 +0300

    IGNITE-28223-add-rowid wip
---
 .../processors/query/calcite/integration/RowIdPseudoColumnTest.java      | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
index eee173feb38..f14f064ab9d 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/RowIdPseudoColumnTest.java
@@ -73,6 +73,7 @@ public class RowIdPseudoColumnTest extends AbstractBasicIntegrationTest {
 
         // TODO: IGNITE-28223-add-rowid Вот тут теперь падает и можно дальше двигать
         assertQuery("select id, name, rowid from PUBLIC.PERSON where rowid = '0'")
+            .columnNames("ID", "NAME", "ROWID")
             .matches(QueryChecker.containsIndexScan("PUBLIC", "PERSON", "_key_PK"))
             .returns(0, "foo0", "0")
             .check();