Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-9945

Subquery inside some Expr subclasses in WHERE results in IllegalStateException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Frontend

    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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tarmstrong Tim Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: