Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/3520#discussion_r106609749 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/common/PushFilterIntoTableSourceScanRuleBase.scala --- @@ -36,36 +43,34 @@ trait PushFilterIntoTableSourceScanRuleBase { filterableSource: FilterableTableSource[_], description: String): Unit = { - if (filterableSource.isFilterPushedDown) { - // The rule can get triggered again due to the transformed "scan => filter" - // sequence created by the earlier execution of this rule when we could not - // push all the conditions into the scan - return - } + Preconditions.checkArgument(!filterableSource.isFilterPushedDown) val program = calc.getProgram + val functionCatalog = FunctionCatalog.withBuiltIns val (predicates, unconvertedRexNodes) = RexProgramExtractor.extractConjunctiveConditions( program, call.builder().getRexBuilder, - tableSourceTable.tableEnv.getFunctionCatalog) + functionCatalog) if (predicates.isEmpty) { // no condition can be translated to expression return } - val (newTableSource, remainingPredicates) = filterableSource.applyPredicate(predicates) - // trying to apply filter push down, set the flag to true no matter whether - // we actually push any filters down. - newTableSource.setFilterPushedDown(true) + val remainingPredicates = new util.LinkedList[Expression]() + predicates.foreach(e => remainingPredicates.add(e)) + + val newTableSource = filterableSource.applyPredicate(remainingPredicates) --- End diff -- OK, you're right. Thanks for the example.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---