This is an automated email from the ASF dual-hosted git repository.
caogaofei 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 35377c69004 Make error msg be semantic when the functionality is not
supported
35377c69004 is described below
commit 35377c69004d508158dc1b46cf5b995f9317452b
Author: Weihao Li <[email protected]>
AuthorDate: Tue Mar 18 13:50:54 2025 +0800
Make error msg be semantic when the functionality is not supported
---
.../db/it/IoTDBMultiTAGsWithAttributesTableIT.java | 16 +++++++--------
.../IoTDBCorrelatedExistsSubqueryIT.java | 24 +++++++++++++---------
.../optimizations/PushPredicateIntoTableScan.java | 3 ++-
3 files changed, 23 insertions(+), 20 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 667ec3e06d4..17e58550b02 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
@@ -23,6 +23,7 @@ import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.TableClusterIT;
import org.apache.iotdb.itbase.category.TableLocalStandaloneIT;
+import org.apache.iotdb.rpc.TSStatusCode;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -2096,29 +2097,26 @@ public class IoTDBMultiTAGsWithAttributesTableIT {
@Test
public void exceptionTest() {
+ String errMsg = TSStatusCode.SEMANTIC_ERROR.getStatusCode() + ": " +
ONLY_SUPPORT_EQUI_JOIN;
tableAssertTestFail(
- "select * from table0 t0 full join table1 t1 on t0.num>t1.num",
- ONLY_SUPPORT_EQUI_JOIN,
- DATABASE_NAME);
+ "select * from table0 t0 full join table1 t1 on t0.num>t1.num",
errMsg, DATABASE_NAME);
tableAssertTestFail(
- "select * from table0 t0 full join table1 t1 on t0.num!=t1.num",
- ONLY_SUPPORT_EQUI_JOIN,
- DATABASE_NAME);
+ "select * from table0 t0 full join table1 t1 on t0.num!=t1.num",
errMsg, DATABASE_NAME);
tableAssertTestFail(
"select * from table0 t0 full join table1 t1 on t0.device=t1.device
AND t0.num>t1.num",
- ONLY_SUPPORT_EQUI_JOIN,
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
"select * from table0 t0 full join table1 t1 on t0.device=t1.device OR
t0.num>t1.num",
- ONLY_SUPPORT_EQUI_JOIN,
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
"select * from table0 t0 full join table1 t1 on t0.device=t1.device OR
t0.time=t1.time",
- ONLY_SUPPORT_EQUI_JOIN,
+ errMsg,
DATABASE_NAME);
}
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/correlated/IoTDBCorrelatedExistsSubqueryIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/correlated/IoTDBCorrelatedExistsSubqueryIT.java
index 1359777653d..fd80453c4df 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/correlated/IoTDBCorrelatedExistsSubqueryIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/subquery/correlated/IoTDBCorrelatedExistsSubqueryIT.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.TableClusterIT;
import org.apache.iotdb.itbase.category.TableLocalStandaloneIT;
+import org.apache.iotdb.rpc.TSStatusCode;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -33,6 +34,7 @@ import org.junit.runner.RunWith;
import static org.apache.iotdb.db.it.utils.TestUtils.prepareTableData;
import static org.apache.iotdb.db.it.utils.TestUtils.tableAssertTestFail;
import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest;
+import static
org.apache.iotdb.db.queryengine.plan.relational.planner.optimizations.JoinUtils.ONLY_SUPPORT_EQUI_JOIN;
import static
org.apache.iotdb.relational.it.query.recent.subquery.SubqueryDataSetUtils.CREATE_SQLS;
import static
org.apache.iotdb.relational.it.query.recent.subquery.SubqueryDataSetUtils.DATABASE_NAME;
import static
org.apache.iotdb.relational.it.query.recent.subquery.SubqueryDataSetUtils.NUMERIC_MEASUREMENTS;
@@ -385,27 +387,29 @@ public class IoTDBCorrelatedExistsSubqueryIT {
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);
}
+ @Test
public void testNonComparisonFilterInCorrelatedExistsSubquery() {
+ String errMsg = TSStatusCode.SEMANTIC_ERROR.getStatusCode() + ": " +
ONLY_SUPPORT_EQUI_JOIN;
// Legality check: Correlated subquery with Non-equality comparison is not
support for now.
tableAssertTestFail(
- "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 > t3.s1);",
- "For now, FullOuterJoin and LeftJoin only support EquiJoinClauses",
+ "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 > t3.s1)",
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
- "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 >= t3.s1);",
- "For now, FullOuterJoin and LeftJoin only support EquiJoinClauses",
+ "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 >= t3.s1)",
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
- "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 < t3.s1);",
- "For now, FullOuterJoin and LeftJoin only support EquiJoinClauses",
+ "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 < t3.s1)",
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
- "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 <= t3.s1);",
- "For now, FullOuterJoin and LeftJoin only support EquiJoinClauses",
+ "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 <= t3.s1)",
+ errMsg,
DATABASE_NAME);
tableAssertTestFail(
- "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 != t3.s1);",
- "For now, FullOuterJoin and LeftJoin only support EquiJoinClauses",
+ "select s1 from table1 t1 where exists(select s1 from table3 t3 where
t1.s1 != t3.s1)",
+ errMsg,
DATABASE_NAME);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
index 516fa7e75aa..4bfcd500098 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
@@ -24,6 +24,7 @@ import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.partition.DataPartitionQueryParam;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.exception.sql.SemanticException;
import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
import org.apache.iotdb.db.queryengine.common.QueryId;
import org.apache.iotdb.db.queryengine.metric.QueryPlanCostMetricSet;
@@ -737,7 +738,7 @@ public class PushPredicateIntoTableScan implements
PlanOptimizer {
equiJoinClauses.add(new JoinNode.EquiJoinClause(leftSymbol,
rightSymbol));
} else {
if (node.getJoinType() != INNER) {
- throw new UnsupportedOperationException(ONLY_SUPPORT_EQUI_JOIN);
+ throw new SemanticException(ONLY_SUPPORT_EQUI_JOIN);
}
joinFilterBuilder.add(conjunct);
}