This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 12d8c4e944e Perfect error message of ASOF JOIN
12d8c4e944e is described below
commit 12d8c4e944e61093cfe948df01b32ef786fdf8e5
Author: Weihao Li <[email protected]>
AuthorDate: Mon May 26 18:21:05 2025 +0800
Perfect error message of ASOF JOIN
---
.../it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java | 12 +++++++++++-
.../queryengine/plan/relational/sql/parser/AstBuilder.java | 11 +++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java
index 1e80e36e42d..0397c05e707 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBMultiTAGsWithAttributesTableIT.java
@@ -2775,7 +2775,17 @@ public class IoTDBMultiTAGsWithAttributesTableIT {
tableAssertTestFail(
"select * from table0 asof (tolerance 1s) left join table1 on
table0.time<=table1.time",
- "Tolerance in ASOF JOIN is only support INNER type now",
+ "Tolerance in ASOF JOIN only supports INNER type now",
+ DATABASE_NAME);
+
+ tableAssertTestFail(
+ "select * from table0 asof right join table1 on
table0.time<=table1.time",
+ "ASOF JOIN does not support RIGHT type now",
+ DATABASE_NAME);
+
+ tableAssertTestFail(
+ "select * from table0 asof full join table1 on
table0.time<=table1.time",
+ "ASOF JOIN does not support FULL type now",
DATABASE_NAME);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
index 9dcb7b134f3..dfea45bde15 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/parser/AstBuilder.java
@@ -2388,8 +2388,15 @@ public class AstBuilder extends
RelationalSqlBaseVisitor<Node> {
joinType = Join.Type.INNER;
}
- if (criteria instanceof AsofJoinOn && joinType != Join.Type.INNER &&
timeDuration != null) {
- throw new SemanticException("Tolerance in ASOF JOIN is only support
INNER type now");
+ if (criteria instanceof AsofJoinOn) {
+ if (joinType == Join.Type.RIGHT || joinType == Join.Type.FULL) {
+ throw new SemanticException(
+ String.format("ASOF JOIN does not support %s type now", joinType));
+ }
+
+ if (joinType != Join.Type.INNER && timeDuration != null) {
+ throw new SemanticException("Tolerance in ASOF JOIN only supports
INNER type now");
+ }
}
return new Join(getLocation(ctx), joinType, left, right, criteria);