You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/07/10 15:54:00 UTC

[jira] [Created] (IMPALA-9945) Subquery inside some Expr subclasses in WHERE results in IllegalStateException

Tim Armstrong created IMPALA-9945:
-------------------------------------

             Summary: Subquery inside some Expr subclasses in WHERE results in IllegalStateException
                 Key: IMPALA-9945
                 URL: https://issues.apache.org/jira/browse/IMPALA-9945
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Tim Armstrong


{noformat}
[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
{noformat}

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
{noformat}
[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
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)