You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (JIRA)" <ji...@apache.org> on 2019/01/11 05:53:00 UTC

[jira] [Commented] (CALCITE-2454) HepPlanner should not pick cached RelNode when type mismatch while digest matches

    [ https://issues.apache.org/jira/browse/CALCITE-2454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16740063#comment-16740063 ] 

Vladimir Sitnikov commented on CALCITE-2454:
--------------------------------------------

[~julianhyde],

1) The test does fail without the fix

2) VolcanoPlanner uses {{Pair.of(newDigest, rel.getRowType())}} for {{mapDigestToRel}}. It was added in https://gitbox.apache.org/repos/asf?p=calcite.git;a=commit;h=e5b0d9d68b802f12aeaaef32ce7ef6a274a2ebda with comment of
{quote} one ProjectRel had an INTEGER null literal and another had a VARCHAR null literal{quote}

I wonder if we should just add data type to the RexLiteral digest instead?

Alternative option is to use {{Pair.of<digest, type>}} keys in planner, and make javadoc for {{org.apache.calcite.plan.RelOptNode#getDigest}} clear that it should not include rowtype since rowtype is an implicit part of the digest. If so, we would want to remove rowtype from Values#digest

Any thoughts?

> HepPlanner should not pick cached RelNode when type mismatch while digest matches
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-2454
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2454
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Yuzhao Chen
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: pull-request-available
>
> After CALCITE-2116, a RelNode will be reused based on digest, but now many nodes's digests do not have type info, e.g. LogicalProject, this will affect some rules when we wanna transform to a node with same digest and same type (HepPlanner may pick out a RelNode with different type).
> So, we should add type info just like VolcanoPlanner.
> We encounter this problem with plan like below:
> {code:java}
> Union
> +-- project1(a: int, b:int, c: double)
> | +-- project2(a: bigint: b: int, c:double)
> +-- project3
> {code}
> We wanna cast a from bigint -> int so we can have a union with project1 and project3, but with ProjectMergeRule, while merging project1 and project2, HepPlanner will think project2 and project1 are identical and it gives back project2. But actually we wanna pick project1.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)