• Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.6.0
    • Fix Version/s: None
    • Component/s: Query Processor
    • Labels:


      Consider this query:

      SELECT a.num FROM (
      SELECT a.num AS num, b.num AS num2
      FROM foo a LEFT OUTER JOIN bar b ON a.num=b.num
      ) a
      WHERE a.num2 IS NULL; this case, the table alias 'a' is ambiguous. It could be the outer table (i.e., the subquery result), or it could be the inner table (foo).

      In the above case, Hive silently parses the outer reference to a as the inner reference. The result, then, is akin to:
      SELECT foo.num FROM foo WHERE bar.num IS NULL. This is bad.

      The bigger problem, however, is that Hive even lets people use the same table alias at multiple points in the query. We should simply throw an exception during the parse stage if there is any ambiguity in which table is which, just like we do if the column names are ambiguous.

      Or, if for some reason we need people to be able to use 'a' to refer to multiple tables or subqueries, it would be excellent if the exact parsing structure were made clear and added to the wiki. In that case, I will file a separate bug JIRA to complain about how it should be different.


        Adam Kramer created issue -
        Namit Jain made changes -
        Field Original Value New Value
        Component/s Query Processor [ 12312586 ]
        John Sichi made changes -
        Fix Version/s 0.6.0 [ 12314524 ]
        Fix Version/s 0.7.0 [ 12315150 ]
        Affects Version/s 0.6.0 [ 12314524 ]
        Carl Steinbach made changes -
        Fix Version/s 0.6.0 [ 12314524 ]
        Carl Steinbach made changes -
        Fix Version/s 0.7.0 [ 12315150 ]
        John Sichi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]


          • Assignee:
            Adam Kramer
          • Votes:
            1 Vote for this issue
            3 Start watching this issue


            • Created: