[
https://issues.apache.org/jira/browse/CALCITE-2997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde resolved CALCITE-2997.
----------------------------------
Resolution: Fixed
Fixed in
[3fa29e17|https://github.com/apache/calcite/commit/3fa29e171d5ba4a23558b2bc6574fee359e24ff0].
The new options are {{SqlToRelConverter.Config.isPushDownJoinCondition()}} and
{{RelBuilder.Config.pushJoinCondition()}}. The defaults are true and false,
respectively, so that the default behavior for both classes is unchanged.
I refactored {{SqlToRelConverter}} to create joins using {{RelBuilder}}, so
both of the above options have the same implementation. This means that join
conditions are now simplified; to compensate, I turned off simplification in a
few tests.
> Avoid pushing down join condition in SqlToRelConverter
> ------------------------------------------------------
>
> Key: CALCITE-2997
> URL: https://issues.apache.org/jira/browse/CALCITE-2997
> Project: Calcite
> Issue Type: Bug
> Reporter: Jin Xing
> Assignee: Julian Hyde
> Priority: Major
> Fix For: 1.24.0
>
>
> In current code, *SqlToRelConverter:createJoin* is calling
> *RelOptUtil.pushDownJoinConditions* for optimization. And we can find below
> conversion from *SqlNode* to *RelNode*:
> {code:java}
> SqlNode:
> select * from A join B on A.x = B.x * 2
> RelNode (Logical-Plan):
> Join (condition:col0=col1)
> |-Project(x as col0)
> | |-Scan(A)
> |-Project(x * 2 as col1)
> |-Scan(B){code}
> As we can see the logical plan(*RelNode*) posted above is not the pure
> reflection of the original SQL String(*SqlNode*). The optimization is mixed
> into the phase on which AST is converted to Logical-Plan. Actually optimizing
> rule of JoinPushExpressionsRule is doing exactly the same kind of thing.
> Shall we just keep the optimization inside Optimized-Logical-Plan ? I mean
> shall we avoid calling *RelOptUtil.pushDownJoinConditions* in
> *SqlToRelConverter:createJoin*
> I raised this issue because that we are doing something based on the
> Logical-Plan. And it makes us really confused that the Logical-Plan doesn't
> corresponds to SqlNode.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)