Hey Eric,

When you have a disjunction in the WHERE clause it may not be safe to
push the condition below a join especially when it comes to outer
joins. I suppose that the FilterJoinRule [1] is the place that you
want to check to see if the filter can be pushed below the join and
into the scan.

Best,
Stamatis

[1] 
https://github.com/apache/calcite/blob/8d9b27f1ace7f975407920cb88806715b1f0ef82/core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java

On Tue, Jan 2, 2024 at 11:22 PM Eric Berryman <[email protected]> wrote:
>
> Hello,
>
> I'm making a FilterableTable with LDAP as a backend.
>
> I noticed in the FilterableTable method:
> public Enumerable<Object[]> scan(DataContext root, List<RexNode> filters)
>
> The filters list is empty if the sql where clause is checking the same
> field in all tables.
> ie.
> select test1.field test2.field
> from test1
> full outer join test2 on test1.id = test2.id
> where test1.field = 'myval' or test2.field = 'myval';
>
> When I do an EXPLAIN PLAN FOR select ...
> I notice the BindableTableScan filters array is empty with both:
> where test1.field = 'myval' or test2.field = 'myval';
> and it has the filter if I remove one:
> where test1.field = 'myval'
>
> Is there an example I could be pointed to help understand the query planner
> here, and hopefully write my implementation such that the filters show up
> as expected for each table?
>
> Thank you!
> Eric

Reply via email to