Sergey Nuyanzin created CALCITE-7909:
----------------------------------------

             Summary: ProjectSetOpTransposeRule returns wrong results for 
EXCEPT ALL and INTERSECT ALL
                 Key: CALCITE-7909
                 URL: https://issues.apache.org/jira/browse/CALCITE-7909
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Sergey Nuyanzin
            Assignee: Sergey Nuyanzin


ProjectSetOpTransposeRule pushes a Project below any SetOp with all = true. 
That is only correct for UNION ALL. EXCEPT ALL and INTERSECT ALL decide which 
rows to keep by comparing whole rows. If the project removes columns first, 
rows that were different can become equal.

{code:sql}
SELECT y FROM (
  SELECT x + 1 AS x, y FROM (VALUES (1, 10)) AS a(x, y)
  EXCEPT ALL
  SELECT x + 1 AS x, y FROM (VALUES (2, 10)) AS b(x, y));
{code}
currently returns no rows while expected {{10}}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to