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

Allow to specify target table columns in static partition insert

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: In Progress
    • Trivial
    • Resolution: Unresolved
    • 2.1.1
    • None
    • SQL
    • None

    Description

      It is not possible to specify target table columns in static partition insert.
      As a result SQL parser will throw an error if fields from sub select does not match target table fields.

      For example for the following table

      CREATE TABLE my_table(col1 STRING, col2 STRING, col3 STRING) PARTITIONED BY (pcol STRING);

      following insert will failed due to different number of fields in select and in target table:

      INSERT OVERWRITE TABLE my_table
      PARTITION(pcol='TEST')
      SELECT 'A' as a, 'B'as b;

      Proposed change adds support for the following syntax:

      INSERT OVERWRITE TABLE my_table
      PARTITION(pcol='TEST')
      (col1, col3)
      SELECT 'A' as a, 'B'as b;

      Issue is marked with Trivial priority as it has workaround such as using dynamic partition insert.

      Attachments

        Activity

          People

            koliynyk Kostyantyn Oliynyk
            koliynyk Kostyantyn Oliynyk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: