[ https://issues.apache.org/jira/browse/CALCITE-2002?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Hyde updated CALCITE-2002: --------------------------------- Summary: DISTINCT applied to VALUES returns wrong result (was: Distinct query against in-memory values is sometimes wrong) > DISTINCT applied to VALUES returns wrong result > ----------------------------------------------- > > 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)