From f14e944477674d987b91a4edacadb58c759eb74d Mon Sep 17 00:00:00 2001 From: suibianwanwan Date: Mon, 7 Oct 2024 16:36:38 +0800 Subject: [PATCH] [CALCITE-6615] BindableTableScan estimateRowCount does not calculate push down filters --- .../main/java/org/apache/calcite/interpreter/Bindables.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java index 069a2cade459..f3a4d22ba12e 100644 --- a/core/src/main/java/org/apache/calcite/interpreter/Bindables.java +++ b/core/src/main/java/org/apache/calcite/interpreter/Bindables.java @@ -269,6 +269,11 @@ public static BindableTableScan create(RelOptCluster cluster, .itemIf("projects", projects, !projects.equals(identity())); } + @Override public double estimateRowCount(RelMetadataQuery mq) { + double f = filters.isEmpty() ? 1d : 0.5d; + return super.estimateRowCount(mq) * f; + } + @Override public @Nullable RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { boolean noPushing = filters.isEmpty()