Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-2228

Can't use DB qualified column names in WHERE or GROUP BY clauses

    XMLWordPrintableJSON

    Details

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

      Description

      Hive doesn't allow you to use DB qualified column names in the WHERE or GROUP BY clauses. The workaround is to define a table alias:

      hive> CREATE DATABASE db1;
      OK
      
      hive> CREATE TABLE db1.t(a INT, b INT);
      OK
      
      hive> SELECT * FROM db1.t WHERE db1.t.a > 100;
      FAILED: Error in semantic analysis: Line 1:26 Invalid table alias or column reference 'db1'
      
      hive> SELECT * FROM db1.t t WHERE t.a > 100;
      OK
      
      hive> SELECT * FROM db1.t GROUP BY db1.t.a;
      FAILED: Error in semantic analysis: Line 1:29 Invalid table alias or column reference 'db1'
      
      hive> SELECT * FROM db1.t t GROUP BY t.a;
      OK
      

        Attachments

        1. HIVE-2228.1.patch.txt
          584 kB
          Zhenxiao Luo
        2. HIVE-2228.2.patch.txt
          539 kB
          Zhenxiao Luo

          Issue Links

            Activity

              People

              • Assignee:
                zhenxiao Zhenxiao Luo
                Reporter:
                cwsteinbach Carl Steinbach
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: