Hi Kuebler,

This is an optimization in FilterJoinRule[1], and yes, it can be configured.

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

Kuebler, Corvin <[email protected]> 于2022年4月11日周一 19:47写道:

> Hi @Caclite Devs,
>
> I recently started working with calcite and stumbled upon some join
> optimization behavior that looks strange to me.
> I was fiddling around with a filtered join on a Jdbc-Datasource:
>
> ```SQL
> SELECT f.name, b. name
> FROM foo f,
> RIGHT JOIN bar b,
> ON f.id = b. id
> WHERE b.property NOT IN (‘’)
> ```
>
> As I inspected the outcomes of this query it became obvious that calcite
> seems to “forget” about the join type in the query. No matter if left or
> right join the resulting physical plan always resulted in an inner join.
>
> This led me to taking a closer look at the source code and I discovered
> the logic in
> https://github.com/apache/calcite/blob/de48e55783a140e6927f88a445d9cbdf2e7623b5/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L2772
> ff.
> It seems that the above behavior is intended and cannot be configured out
> as the parameter to do so should not be set to false in production (
> https://github.com/apache/calcite/blob/de48e55783a140e6927f88a445d9cbdf2e7623b5/core/src/main/java/org/apache/calcite/rel/rules/CoreRules.java#L239
> ).
>
> Is there any chance you could explain to me why one would want to ignore
> the join type and filter out null columns? Is there any way to disable this
> behavior?
>
> Thanks in advance.
>
> Bests regards,
> Corvin Kübler
>
>

-- 

Best,
Benchao Li

Reply via email to