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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 7985a729a762066e3144cf20e22f2276ed641bc0
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Fri Sep 8 21:11:48 2023 +0800

    [fix](explain) fix explain physical plan with external table issue (#23845)
    
    The `SelectedPartitions` can not be null, or it will throw NPE and fallback 
to origin planner.
---
 .../doris/nereids/trees/plans/logical/LogicalFileScan.java   | 12 +++++++++---
 .../suites/external_table_p0/hive/test_hive_parquet.groovy   |  6 ++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFileScan.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFileScan.java
index e821eedbc0..4b46084a82 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFileScan.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalFileScan.java
@@ -64,7 +64,7 @@ public class LogicalFileScan extends LogicalCatalogRelation {
 
     public LogicalFileScan(RelationId id, ExternalTable table, List<String> 
qualifier) {
         this(id, table, qualifier, Optional.empty(), Optional.empty(),
-                Sets.newHashSet(), null);
+                Sets.newHashSet(), SelectedPartitions.EMPTY);
     }
 
     @Override
@@ -121,9 +121,14 @@ public class LogicalFileScan extends 
LogicalCatalogRelation {
      * Mainly for hive table partition pruning.
      */
     public static class SelectedPartitions {
-        /** total partition number */
+        public static SelectedPartitions EMPTY = new SelectedPartitions(0, 
Maps.newHashMap(), false);
+        /**
+         * total partition number
+         */
         public long totalPartitionNum = 0;
-        /** partition id -> partition item */
+        /**
+         * partition id -> partition item
+         */
         public Map<Long, PartitionItem> selectedPartitions;
         /**
          * true means the result is after partition pruning
@@ -151,3 +156,4 @@ public class LogicalFileScan extends LogicalCatalogRelation 
{
         }
     }
 }
+
diff --git 
a/regression-test/suites/external_table_p0/hive/test_hive_parquet.groovy 
b/regression-test/suites/external_table_p0/hive/test_hive_parquet.groovy
index bbe324ff2e..cc16ca27d1 100644
--- a/regression-test/suites/external_table_p0/hive/test_hive_parquet.groovy
+++ b/regression-test/suites/external_table_p0/hive/test_hive_parquet.groovy
@@ -151,6 +151,8 @@ suite("test_hive_parquet", "p0") {
             );"""
             sql """use `${catalog_name}`.`default`"""
 
+            sql """set enable_fallback_to_original_planner=false;"""
+
             q01()
             q02()
             q03()
@@ -172,6 +174,10 @@ suite("test_hive_parquet", "p0") {
             q19()
             q20()
 
+            sql """explain physical plan select l_partkey from partition_table
+                where (nation != 'cn' or city !='beijing') and (l_quantity > 
28 or l_extendedprice > 30000)
+                order by l_partkey limit 10;"""
+
             sql """drop catalog if exists ${catalog_name}"""
         } finally {
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to