Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-20690

Subqueries in FROM should have alias names

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: SQL
    • Labels:
      None

      Description

      We add missing attributes into Filter in Analyzer. But we shouldn't do it through subqueries like this:

      select 1 from  (select 1 from onerow t1 LIMIT 1) where  t1.c1=1
      

      This query works in current codebase. However, the outside where clause shouldn't be able to refer t1.c1 attribute.

      The root cause is we allow subqueries in FROM have no alias names previously, it is confusing and isn't supported by various databases such as MySQL, Postgres, Oracle. We shouldn't support it too.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                viirya Liang-Chi Hsieh
                Reporter:
                viirya Liang-Chi Hsieh
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: