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 93b2d1fe999 Make ErrMsg more readable when the predicate has too many 
conjunctions because of too many devices #16715
93b2d1fe999 is described below

commit 93b2d1fe99917ec02dcca3e8d4ad53ef7bc573f8
Author: Weihao Li <[email protected]>
AuthorDate: Tue Nov 11 10:45:02 2025 +0800

    Make ErrMsg more readable when the predicate has too many conjunctions 
because of too many devices #16715
---
 .../db/queryengine/plan/analyze/PredicateUtils.java      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/PredicateUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/PredicateUtils.java
index 381e8cfb5a0..9b45d2c51fa 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/PredicateUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/PredicateUtils.java
@@ -338,6 +338,12 @@ public class PredicateUtils {
     if (conjuncts.size() == 1) {
       return conjuncts.get(0);
     }
+
+    if (conjuncts.size() > 1000) {
+      throw new SemanticException(
+          "There are too many conjuncts (more than 1000) in predicate after 
rewriting, this may be caused by too many devices in query, try to use ALIGN BY 
DEVICE");
+    }
+
     return constructRightDeepTreeWithAnd(conjuncts);
   }
 
@@ -346,14 +352,8 @@ public class PredicateUtils {
     if (conjuncts.size() == 2) {
       return new LogicAndExpression(conjuncts.get(0), conjuncts.get(1));
     } else {
-      try {
-        return new LogicAndExpression(
-            conjuncts.get(0),
-            constructRightDeepTreeWithAnd(conjuncts.subList(1, 
conjuncts.size())));
-      } catch (StackOverflowError e) {
-        throw new SemanticException(
-            "There are too many conjuncts in predicate after rewriting, this 
may be caused by too many devices, try to use ALIGN BY DEVICE");
-      }
+      return new LogicAndExpression(
+          conjuncts.get(0), constructRightDeepTreeWithAnd(conjuncts.subList(1, 
conjuncts.size())));
     }
   }
 

Reply via email to