Hi, I’m facing a strange issue with Flink 1.8.1. I’ve implemented a 
StreamTableSource that implements FilterableTableSource and 
ProjectableTableSource. However, I’m seeing that during the logical plan 
optimization (TableEnvironment.scala:288), the applyPredicates method is called 
but the resulting plan does NOT contain the source with the filter pushed.

It appears that the problem is in the VolcanoPlanner.findBestExp method; when 
it reaches “root.buildCheapestPlan”, the resulting RelNode does not contain the 
filtered source.

Additionally, I added a breakpoint in 
FlinkLogicalTableSourceScan#computeSelfCost, and the tableSource never has the 
predicates pushed. I verified that in the PushFilterIntoTableSourceScanRule, 
the resulting source always has the predicates pushed.

Amusingly, this issue causes queries like “SELECT a FROM src WHERE a = 123” to 
be rewritten to “SELECT 123 FROM src” :-)

Does anyone have any advice on debugging/working around this without disabling 
predicate pushdown on the source?

Reply via email to