Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
ghx-label-5
Description
[localhost.EXAMPLE.COM:21000] default> explain select * from functional.alltypes t where nvl(exists(select id from functional.alltypesagg), false); Query: explain select * from functional.alltypes t where nvl(exists(select id from functional.alltypesagg), false) ERROR: IllegalStateException: Failed analysis after expr substitution. CAUSED BY: ClassCastException: org.apache.impala.analysis.SlotRef cannot be cast to org.apache.impala.analysis.Subquery [localhost.EXAMPLE.COM:21000] default> explain select * from functional.alltypes t where case when id % 2 = 0 then exists(select id from functional.alltypesagg) end; Query: explain select * from functional.alltypes t where case when id % 2 = 0 then exists(select id from functional.alltypesagg) end ERROR: IllegalStateException: Failed analysis after expr substitution. CAUSED BY: ClassCastException: org.apache.impala.analysis.SlotRef cannot be cast to org.apache.impala.analysis.Subquery
These predicates are not expected to be supported - since we don't support arbitrary subqueries in where - see IMPALA-5226 - but we should produce a more meaningful error, like
[localhost.EXAMPLE.COM:21000] default> explain select * from functional.alltypes t where cast((t.id IN (select id from functional.alltypesagg) or t.bool_col = false) as string) is not null; Query: explain select * from functional.alltypes t where cast((t.id IN (select id from functional.alltypesagg) or t.bool_col = false) as string) is not null ERROR: AnalysisException: Unsupported IS NULL predicate that contains a subquery: CAST((t.id IN (SEL ECT id FROM functional.alltypesagg) OR t.bool_col = FALSE) AS STRING) IS NOT NULL