This is an automated email from the ASF dual-hosted git repository.
nizhikov 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 f6edd3b366e IGNITE-28536 Explicit error message for ASOF join (#13019)
f6edd3b366e is described below
commit f6edd3b366e1596b7034bc45f2dba5f50206cd46
Author: Nikolay <[email protected]>
AuthorDate: Tue Apr 14 11:49:59 2026 +0300
IGNITE-28536 Explicit error message for ASOF join (#13019)
---
.../query/calcite/prepare/IgniteSqlValidator.java | 9 +++++++++
.../query/calcite/util/IgniteResource.java | 4 ++++
.../DistributedJoinIntegrationTest.java | 22 ++++++++++++++++++++++
3 files changed, 35 insertions(+)
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java
index 92308f805a4..8d25cf1c249 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java
@@ -30,6 +30,7 @@ import org.apache.calcite.prepare.Prepare;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.sql.JoinConditionType;
+import org.apache.calcite.sql.JoinType;
import org.apache.calcite.sql.SqlAggFunction;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlCallBinding;
@@ -327,6 +328,14 @@ public class IgniteSqlValidator extends SqlValidatorImpl {
super.validateAggregateParams(aggCall, filter, null, orderList, scope);
}
+ /** {@inheritDoc} */
+ @Override protected void validateJoin(SqlJoin join, SqlValidatorScope
scope) {
+ if (join.getJoinType() == JoinType.ASOF || join.getJoinType() ==
JoinType.LEFT_ASOF)
+ throw newValidationError(join,
IgniteResource.INSTANCE.unsupportedJoinType(join.getJoinType().name().replace('_',
' ')));
+
+ super.validateJoin(join, scope);
+ }
+
/** {@inheritDoc} */
@Override protected SqlNode performUnconditionalRewrites(SqlNode node,
boolean underFrom) {
// Workaround for https://issues.apache.org/jira/browse/CALCITE-4923
diff --git
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteResource.java
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteResource.java
index f4d7181c6fd..df74d56a916 100644
---
a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteResource.java
+++
b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteResource.java
@@ -77,6 +77,10 @@ public interface IgniteResource {
@Resources.BaseMessage("Unsupported clause ''{0}''")
Resources.ExInst<SqlValidatorException> unsupportedClause(String value);
+ /** */
+ @Resources.BaseMessage("Unsupported join type ''{0}''")
+ Resources.ExInst<SqlValidatorException> unsupportedJoinType(String value);
+
/** */
@Resources.BaseMessage("Operator ''CAST'' supports only the parameters:
value and target type.")
Resources.ExInst<SqlValidatorException> invalidCastParameters();
diff --git
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
index e4feefe83a3..9249c495d33 100644
---
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
+++
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DistributedJoinIntegrationTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.query.calcite.integration;
import java.math.BigDecimal;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
@@ -130,6 +131,27 @@ public class DistributedJoinIntegrationTest extends
AbstractBasicIntegrationTran
.check();
}
+ /** */
+ @Test
+ public void testAsofJoinUnsupported() {
+ checkNotSupported("ASOF");
+ }
+
+ /** */
+ @Test
+ public void testLeftAsofJoinUnsupported() {
+ checkNotSupported("LEFT ASOF");
+ }
+
+ /** */
+ private void checkNotSupported(String joinType) {
+ assertThrows("SELECT *\n" +
+ " FROM (VALUES (NULL, 0), (1, NULL), (1, 0), (1, 1), (1, 2), (1,
3), (1, 4), (2, 3), (3, 4)) AS t1(k, t)\n" +
+ " " + joinType + " JOIN (VALUES (1, NULL), (1, 2), (1, 3), (2,
10), (2, 0)) AS t2(k, t)\n" +
+ " MATCH_CONDITION t2.t < t1.t\n" +
+ " ON t1.k = t2.k", IgniteSQLException.class, "Unsupported join
type '" + joinType + "'");
+ }
+
/** Prepare tables orders and order_items with data. */
private void prepareTables() {
sql("CREATE TABLE items (\n" +