NobiGo commented on code in PR #3899:
URL: https://github.com/apache/calcite/pull/3899#discussion_r1702918682


##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -3812,4 +3812,242 @@ WHERE s1.total > (SELECT avg(total) FROM agg_sal s2 
WHERE s1.deptno = s2.deptno)
 
 !ok
 
+# [CALCITE-6506] Type inference for IN list is incorrect
+
+# Test LHS is no nullable and RHS is no nullable
+select empno, empno in (7369, 7499, 7521) from emp;
++-------+--------+
+| EMPNO | EXPR$1 |
++-------+--------+
+|  7369 | true   |
+|  7499 | true   |
+|  7521 | true   |
+|  7566 | false  |
+|  7654 | false  |
+|  7698 | false  |
+|  7782 | false  |
+|  7788 | false  |
+|  7839 | false  |
+|  7844 | false  |
+|  7876 | false  |
+|  7900 | false  |
+|  7902 | false  |
+|  7934 | false  |
++-------+--------+
+(14 rows)
+
+!ok
+
+
+EnumerableCalc(expr#0..5=[{inputs}], expr#6=[IS NOT NULL($t5)], 
expr#7=[0:BIGINT], expr#8=[<>($t1, $t7)], expr#9=[AND($t6, $t8)], 
expr#10=[<($t2, $t1)], expr#11=[null:BOOLEAN], expr#12=[IS NULL($t5)], 
expr#13=[AND($t10, $t11, $t8, $t12)], expr#14=[OR($t9, $t13)], 
expr#15=[CAST($t14):BOOLEAN NOT NULL], EMPNO=[$t0], EXPR$1=[$t15])

Review Comment:
   Yes. The RHS is (nullable, nullable) which makes this plan complicated. If 
we can optimize this EnumerableCalc using SEARCH, I will check this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to