[ 
https://issues.apache.org/jira/browse/CALCITE-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde resolved CALCITE-4515.
----------------------------------
    Fix Version/s: 1.27.0
       Resolution: Fixed

Fixed in 
[93c30503|https://github.com/apache/calcite/commit/93c305031fb6c152c118390647f2b9b0979109c2];
 thanks for the PR, [~vozerov]!

> Do not generate the new join tree from commute/associate rules if there are 
> "always TRUE" conditions
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4515
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4515
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Vladimir Ozerov
>            Assignee: Vladimir Ozerov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.27.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{JoinCommuteRule}} and {{JoinAssociateRule}} form a complete ruleset to 
> generate all bushy trees (plus join-project transposes to counter new 
> projects created during commute).
> These rules do not check whether the new join trees contain an always 
> {{TRUE}} condition which is a cross-product. Such join trees are not optimal 
> in the majority of cases, and practical optimizers might want to suppress 
> them.
> In this ticket, I propose to add a configuration property to 
> {{JoinCommuteRule}} and {{JoinAssociateRule}} to disable the creation of 
> trees with always {{TRUE}} condition:
>  # The property should be disabled by default because sometimes 
> cross-products might be present in the query on purpose (e.g., see 
> [https://dl.acm.org/doi/10.5555/645916.671976], page 315)
>  # We consider the "always {{TRUE}}" condition only, even though they 
> represent only part of cross-products. The reason is that it might be 
> difficult and expensive to understand whether the condition is cross-join or 
> not (e.g., for hypergraphs). On the other hand, the check for "always true" 
> is cheap and robust. We assume that the user might need to do some 
> pre-processing (e.g., filter push-down) to take advantage of the new 
> property. 
> # We do not extend the {{JoinPushThroughJoinRule}} for now, since the 
> [commute + associate] ruleset already explores all bushy trees and testing of 
> the new property for {{JoinPushThroughJoinRule}} is difficult. We may extend 
> this rule in a separate ticket if needed.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to