Hello,
We're currently working with Calcite and have a use case where we use
expensive User-Defined Functions in our `WHERE` clauses.
We've noticed that Calcite's default behavior is to eagerly push these
filters down the plan. However, for these specific "heavy" UDFs, this
optimization can sometimes be detrimental to performance, as the cost of
executing the function on many rows outweighs the benefit of filtering
early.
We were wondering if `FilterJoinRule` could be made more configurable? For
example, this might look something like this:
```
FilterJoinRule.Config MY_CONFIG = CoreRules.FILTER_INTO_JOIN.config
.withPredicate(...)
.withCondition(call -> {
Filter filter = call.rel(0);
// User-defined logic to inspect the filter
return !containsHeavyUDF(filter.getCondition());
});
```
If the `withCondition` predicate returns `false`, that specific filter does
not get pushed down.
Does this seem like a reasonable addition?
Best regards,
Danylo