You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "zhen wang (JIRA)" <ji...@apache.org> on 2018/02/13 08:04:00 UTC

[jira] [Commented] (CALCITE-2002) Distinct query against in-memory values is sometimes wrong

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

zhen wang commented on CALCITE-2002:
------------------------------------

 current conclusion is : the first query is screwed by the optimization un-intended. I'm still looking into the optimization details. 

> Distinct query against in-memory values is sometimes wrong
> ----------------------------------------------------------
>
>                 Key: CALCITE-2002
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2002
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Marc Prud'hommeaux
>            Assignee: Julian Hyde
>            Priority: Major
>
> The following output is clearly wrong:
> {code:title=baddistinct.sql|borderStyle=solid}
> 0: jdbc:calcite:model=inline:{"version":1.0,"> SELECT DISTINCT T.B FROM (VALUES (1, 'X'),(2, 'Y'),(3, 'X'),(4, 'X')) AS T(A, B);
> +---+
> | B |
> +---+
> | X |
> | Y |
> | X |
> | X |
> +---+
> 4 rows selected (0.014 seconds)
> {code}
> I'm guessing it is distinct-ing against the complete value tuple rather than the selected column, since the following is correct:
> {code:title=gooddistinct.sql|borderStyle=solid}
> 0: jdbc:calcite:model=inline:{"version":1.0,"> SELECT DISTINCT T.B FROM (VALUES (1, 'X'),(2, 'Y'),(3, 'X'),(3, 'X')) AS T(A, B);
> +---+
> | B |
> +---+
> | X |
> | Y |
> +---+
> 2 rows selected (0.013 seconds)
> {code}



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