From b0e0156b460ec1a09135fb782fc0e54821115e75 Mon Sep 17 00:00:00 2001 From: englefly Date: Tue, 12 Sep 2023 22:44:18 +0800 Subject: [PATCH] fix missing stats --- .../post/PushdownFilterThroughProject.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PushdownFilterThroughProject.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PushdownFilterThroughProject.java index 67159a772823740..56f66e020895b08 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PushdownFilterThroughProject.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PushdownFilterThroughProject.java @@ -19,6 +19,7 @@ import org.apache.doris.nereids.CascadesContext; import org.apache.doris.nereids.properties.PhysicalProperties; +import org.apache.doris.nereids.trees.plans.AbstractPlan; import org.apache.doris.nereids.trees.plans.Plan; import org.apache.doris.nereids.trees.plans.physical.PhysicalFilter; import org.apache.doris.nereids.trees.plans.physical.PhysicalPlan; @@ -37,10 +38,14 @@ public Plan visitPhysicalFilter(PhysicalFilter filter, CascadesC Plan child = filter.child(); if (!(child instanceof PhysicalProject)) { PhysicalPlan newChild = (PhysicalPlan) child.accept(this, context); - newChild = newChild.withPhysicalPropertiesAndStats(properties, stats); - PhysicalPlan ret = ((PhysicalPlan)(filter.withChildren(newChild))) - .withPhysicalPropertiesAndStats(properties, stats); - return ret; + if (child != newChild) { + newChild = newChild.withPhysicalPropertiesAndStats( + ((PhysicalPlan)child).getPhysicalProperties(), + ((AbstractPlan)child).getStats()); + return ((PhysicalPlan) (filter.withChildren(newChild))) + .withPhysicalPropertiesAndStats(properties, stats); + } + return filter; } PhysicalProject project = (PhysicalProject) child; @@ -51,6 +56,6 @@ public Plan visitPhysicalFilter(PhysicalFilter filter, CascadesC newChild = newChild.withPhysicalPropertiesAndStats(properties, stats); PhysicalPlan ret = ((PhysicalPlan) (project.withChildren(newChild))) .withPhysicalPropertiesAndStats(properties, stats); - return ret ; + return ret; } }