You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a query like that: SELECT "a"."ca_state" AS "STATE", "c"."c_customer_sk", "c"."c_current_addr_sk", "s"."ss_customer_sk", "s"."ss_sold_date_sk", "s"."ss_item_sk" FROM customer_address a LEFT JOIN customer c ON "a"."ca_address_sk" = "c"."c_current_addr_sk" INNER JOIN store_sales s ON "c"."c_customer_sk" = "s"."ss_customer_sk"
There would be a tree where inner join is on top of left join. Since inner join would filter out all null records it's safe to convert left join to inner join. The problem is that PredicatePushDown would do this optimization only if dynamic filtering is enabled. It seems wrong, since there is no need of dynamic filtering to figure out that we can convert this join. The problem in the code is that Trino doesn't push down join condition if dynamic filtering is disabled. Here is the relevant piece of code: https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/sql/planner/optimizations/PredicatePushDown.java#L525C84-L525C99 . I wonder, is it done on purpose or it's a bug?
The text was updated successfully, but these errors were encountered:
This is probably the same issue as #2392
We have tried adding and pushing down IS NOT NULL predicate for INNER JOINs before #3688 and #2415
It didn't give much benefits overall.
Dynamic filter functions happen to filter nulls most of the time and influence optimizer decisions like whether LEFT join can be converted to INNER and also help in filtering nulls on the probe side scan.
There is no practical reason to turn off dynamic filtering, so there hasn't been a need to do this optimization separately.
cc: @sopel39
If I have a query like that:
SELECT "a"."ca_state" AS "STATE", "c"."c_customer_sk", "c"."c_current_addr_sk", "s"."ss_customer_sk", "s"."ss_sold_date_sk", "s"."ss_item_sk" FROM customer_address a LEFT JOIN customer c ON "a"."ca_address_sk" = "c"."c_current_addr_sk" INNER JOIN store_sales s ON "c"."c_customer_sk" = "s"."ss_customer_sk"
There would be a tree where inner join is on top of left join. Since inner join would filter out all null records it's safe to convert left join to inner join. The problem is that PredicatePushDown would do this optimization only if dynamic filtering is enabled. It seems wrong, since there is no need of dynamic filtering to figure out that we can convert this join. The problem in the code is that Trino doesn't push down join condition if dynamic filtering is disabled. Here is the relevant piece of code: https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/sql/planner/optimizations/PredicatePushDown.java#L525C84-L525C99 . I wonder, is it done on purpose or it's a bug?
The text was updated successfully, but these errors were encountered: