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

caogaofei pushed a commit to branch beyyes/fix_logical_and
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 3c6cf84e1f4fcb8d68251b6afa15cc83eb4826f6
Author: Beyyes <[email protected]>
AuthorDate: Tue Jul 23 17:21:54 2024 +0800

    fix logical and in PushPredicateIntoTableScan
---
 .../planner/optimizations/PushPredicateIntoTableScan.java         | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 6dfec749d5d..4d4c6152493 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
@@ -169,7 +169,13 @@ public class PushPredicateIntoTableScan implements 
PlanOptimizer {
           tableScanNode.setTimePredicate(resultPair.left);
         }
         if (Boolean.TRUE.equals(resultPair.right)) {
-          tableScanNode.setPushDownPredicate(pushDownPredicate);
+          if (pushDownPredicate instanceof LogicalExpression
+              && ((LogicalExpression) pushDownPredicate).getTerms().size() == 
1) {
+            tableScanNode.setPushDownPredicate(
+                ((LogicalExpression) pushDownPredicate).getTerms().get(0));
+          } else {
+            tableScanNode.setPushDownPredicate(pushDownPredicate);
+          }
         }
       } else {
         tableScanNode.setPushDownPredicate(null);

Reply via email to