You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2024/10/15 15:51:37 UTC
(ignite) branch master updated: IGNITE-23435 SQL Calcite: Fix compiled expression cache key for correlated variable (#11593)
This is an automated email from the ASF dual-hosted git repository.
alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new e9484085676 IGNITE-23435 SQL Calcite: Fix compiled expression cache key for correlated variable (#11593)
e9484085676 is described below
commit e9484085676b37dd69a2ce7e31385987aec8d8d7
Author: Aleksey Plekhanov <Pl...@gmail.com>
AuthorDate: Tue Oct 15 18:51:31 2024 +0300
IGNITE-23435 SQL Calcite: Fix compiled expression cache key for correlated variable (#11593)
---
.../calcite/exec/exp/ExpressionFactoryImpl.java | 1 +
.../integration/CorrelatesIntegrationTest.java | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
index 910cedc8d14..112fd30c24b 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
@@ -568,6 +568,7 @@ public class ExpressionFactoryImpl<Row> implements ExpressionFactory<Row> {
new RexShuttle() {
@Override public RexNode visitFieldAccess(RexFieldAccess fieldAccess) {
b.append(", fldIdx=").append(fieldAccess.getField().getIndex());
+ b.append(", fldType=").append(fieldAccess.getField().getType().getFullTypeString());
return super.visitFieldAccess(fieldAccess);
}
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
index 3e144df2800..b1d8fc330b4 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CorrelatesIntegrationTest.java
@@ -37,6 +37,29 @@ public class CorrelatesIntegrationTest extends AbstractBasicIntegrationTest {
.check();
}
+ /**
+ * Check compiled expression cache correctness for correlated variables with different data types.
+ */
+ @Test
+ public void testCorrelatesDifferentDataType() {
+ for (String type : new String[] {"INTEGER", "TINYINT"}) {
+ try {
+ sql("CREATE TABLE t1(v INTEGER)");
+ sql("CREATE TABLE t2(v " + type + ")");
+ sql("INSERT INTO t1 VALUES (1)");
+ sql("INSERT INTO t2 VALUES (1)");
+
+ assertQuery("SELECT (SELECT t1.v + t2.v FROM t1) FROM t2")
+ .returns(2)
+ .check();
+ }
+ finally {
+ sql("DROP TABLE t1");
+ sql("DROP TABLE t2");
+ }
+ }
+ }
+
/**
* Checks that correlates can't be moved under the table spool.
*/