Martijn Visser created FLINK-41680:
--------------------------------------

             Summary: Batch INTERSECT/EXCEPT fails to plan when the left input 
is NOT NULL and the right input is nullable
                 Key: FLINK-41680
                 URL: https://issues.apache.org/jira/browse/FLINK-41680
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: Martijn Visser


In batch mode, INTERSECT and EXCEPT fail during planning when a column of the 
left input is NOT NULL and the matching column of the right input is nullable. 
The reverse order works.

CREATE TEMPORARY TABLE nn (k INT NOT NULL) WITH ('connector' = 'values', 
'bounded' = 'true');
CREATE TEMPORARY TABLE nl (k INT) WITH ('connector' = 'values', 'bounded' = 
'true');
SELECT k FROM nn INTERSECT SELECT k FROM nl;  -- fails
SELECT k FROM nn EXCEPT SELECT k FROM nl;     -- fails
SELECT k FROM nl INTERSECT SELECT k FROM nn;  -- works

java.lang.IllegalArgumentException: Type mismatch:
rel rowtype: RecordType(INTEGER NOT NULL k) NOT NULL
equiv rowtype: RecordType(INTEGER k) NOT NULL

ReplaceIntersectWithSemiJoinRule and ReplaceMinusWithAntiJoinRule keep the left 
input's type instead of the set operation's nullable type. 



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

Reply via email to