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

Cannot resolve correlated column reference inside a BETWEEN predicate.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Impala 2.3.0, Impala 2.5.0, Impala 2.4.0, Impala 2.6.0
    • Fix Version/s: Impala 2.7.0, Impala 2.6.2
    • Component/s: Frontend
    • Labels:

      Description

      Impala fails to properly resolve correlated column references in a BETWEEN predicate.
      This is a regression from Impala 2.2, introduced in

      Consider the following query with a correlated BETWEEN predicate in an IN subquery:

      select 1 from functional.alltypes t1
      where t1.id in
        (select test_id from functional.jointbl t2
         where t2.test_id between t1.tinyint_col and t1.int_col)
      ERROR: AnalysisException: Could not resolve column/field reference: 't1.tinyint_col'
      
      select 1 from functional.alltypes t1
      where t1.id in
        (select test_id from functional.jointbl t2
         where t2.test_id between tinyint_col and int_col)
      ERROR: AnalysisException: Could not resolve column/field reference: 'tinyint_col'
      

      Workaround
      Rewrite the BETWEEN predicate as an explicit range condition:

      select 1 from functional.alltypes t1
      where t1.id in
        (select test_id from functional.jointbl t2
         where t2.test_id >= t1.tinyint_col and t2.test_id <= t1.int_col)
      

        Attachments

          Activity

            People

            • Assignee:
              alex.behm Alexander Behm
              Reporter:
              alex.behm Alexander Behm
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: