Etienne Pelissier created CALCITE-7959:
------------------------------------------

             Summary: Incorrect RelMdMaxRowCount for ANTI joins can cause wrong 
query results
                 Key: CALCITE-7959
                 URL: https://issues.apache.org/jira/browse/CALCITE-7959
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Etienne Pelissier
            Assignee: Etienne Pelissier


Broken Quidem test:
{code:java}
!set hep-rules "
+MINUS_TO_ANTI_JOIN"

SELECT x FROM (VALUES (1), (1)) AS l(x)
EXCEPT
SELECT y FROM (VALUES (0)) AS r(y) WHERE FALSE;
+---+
| X |
+---+
| 1 |
+---+
(1 row)
{code}
The result produced by Calcite contains two rows instead of one.

RelMdMaxRowCount for the generated ANTI JOIN returns 0, using the standard JOIN 
cardinality formula where the right table is empty, which is incorrect for an 
ANTI JOIN.



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

Reply via email to