incubator-doris ”in subquery/not in subquery“ compute error when subquery contain null

tpxzln5u  于 2022-04-22  发布在  Java
关注(0)|答案(0)|浏览(272)

1、对于in predicate来说,如果in后面所包含的集合中包含null的话,属于正常的sql,不应该报错。下面两个语句应该都返回Empty Set。 mysql和oracle都返回Empty Set。

mysql> select * from (select 1)a where 1 in (null,2);
ERROR 1064 (HY000): Unexpected exception: null
mysql> select * from (select 1)a where 1 not in (null,2);
ERROR 1064 (HY000): Unexpected exception: null

2、另外in subquery子查询改写时,需要支持null_aware_anti_join, 否则not in subquery改写成anti join的话,假设subquery中包含null的话,doris的子查询改写输出的结果可能是错的(null aware anti join需要对null值特殊处理,原因同1)。
下面的sql应该返回empty set。mysql和oracle都返回Empty Set。
mysql> select * from (select 2 as a)t where t.a not in (select a from (select 1 as a union select null as a)t2);
+------+
| a |
+------+
| 2 |
+------+
1 row in set (0.03 sec)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题