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

Subquery inside some Expr subclasses in WHERE results in IllegalStateException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Frontend
    • Labels:

      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

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

              Dates

              • Created:
                Updated: