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

Hive doesn't support column list specification in INSERT into statements with distribute by/Cluster by

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: Parser, Query Processor, SQL
    • Labels:
      None

      Description

      INSERT into TABLE target_table_2 partition (col3) (col1, col2,col3)

      SELECT col1,col2,col3
      FROM source_table
      DISTRIBUTE BY col1 
      SORT BY col1,col2;

      This Insert statement throws 

      Error: Error while compiling statement: FAILED: SemanticException [Error 10004]: Line 4:14 Invalid table alias or column reference 'col1':

      Query is executed successfully with below workaround:

      INSERT into TABLE target_table_2 partition (col3) (col1, col2,col3)
      select * From (SELECT col1, col2,col3 
      FROM source_table
      DISTRIBUTE BY col1 
      SORT BY col1,col2) a;

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rtrivedi12 Riju Trivedi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: