This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 34e6f28aead [To dev/1.3] Make ErrMsg more readable when the predicate 
has too many conjunctions because of too many devices #16716
34e6f28aead is described below

commit 34e6f28aeadf0687184e352c91a6a00e69275ec7
Author: Weihao Li <[email protected]>
AuthorDate: Tue Nov 11 10:30:02 2025 +0800

    [To dev/1.3] Make ErrMsg more readable when the predicate has too many 
conjunctions because of too many devices #16716
---
 .../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 5868d050f8a..4a65ebbfe72 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
@@ -304,6 +304,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);
   }
 
@@ -312,14 +318,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