Description
Simple reproducer
-------------------------------------------------------------------------------------
- Create table part using q_test_init.sql
- Run the following query
explain SELECT p1.p_name FROM part p1 LEFT JOIN (select p_type as p_col from part ) p2 WHERE NOT EXISTS + (select pp1.p_type as p_col from part pp1 where pp1.p_partkey = p2.p_col);
-------------------------------------------------------------------------------------
Following query is failing with SemanticException
Query:
SELECT DISTINCT t1.smallint_col_11 FROM table_21 t1 LEFT JOIN ( SELECT smallint_col_45, (-224) - (COALESCE(MIN(665) OVER (ORDER BY smallint_col_45 DESC, varchar0170_col_23 DESC), NULL, -631)) AS int_col, AVG((GREATEST(CAST(806 AS int), CAST(-606 AS int))) * (39)) OVER (PARTITION BY smallint_col_45 ORDER BY smallint_col_45 DESC, varchar0170_col_23 ASC ROWS BETWEEN 24 FOLLOWING AND UNBOUNDED FOLLOWING) AS float_col, COALESCE(338, (965) + (-335), MAX(544) OVER (PARTITION BY varchar0170_col_23)) AS int_col_1, varchar0170_col_23 FROM table_20 ) t2 ON (((t2.int_col_1) = (t1.smallint_col_3)) AND ((t2.smallint_col_45) = (t1.smallint_col_11))) AND ((t2.smallint_col_45) = (t1.smallint_col_11)) WHERE NOT EXISTS (SELECT COALESCE(tt1.smallint_col_11, tt2.smallint_col_3, tt1.smallint_col_11) AS int_col FROM table_21 tt1 INNER JOIN table_21 tt2 ON (tt2.smallint_col_11) = (tt1.smallint_col_3) WHERE ((tt2.smallint_col_11) >= (tt1.smallint_col_3)) AND ((t2.int_col) = (tt2.smallint_col_3)))