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

INSERT INTO behaves like INSERT OVERWRITE if the table name referred is not all lowercase

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.0
    • None
    • Database/Schema
    • None
    • Windows 2012, HDInsight

    Description

      If table referred does not use all lowercase in INSERT INTO command, the data is not appended but overwritten.

      set hive.exec.dynamic.partition.mode=nonstrict;
      set hive.exec.dynamic.partition=true;

      CREATE TABLE test (key int, value string) PARTITIONED BY (ds string);

      SELECT * FROM test;
      INSERT INTO TABLE test PARTITION (ds) SELECT key, value, value FROM src;
      SELECT * FROM test;

      The following statement works as expected. The data from src is appended to test

      SELECT * FROM test;
      INSERT INTO TABLE test PARTITION (ds) SELECT key, value, value FROM src;
      SELECT * FROM test;

      The following is copied from the processing log
      Loading data to table default.test partition (ds=null)
      Loading partition

      {ds=1}
      Loading partition {ds=2}


      The following statement does not work. Note the table name referred as Test (not test). INSERT INTO behaves like INSERT OVERWRITE

      SELECT * FROM test;
      INSERT INTO TABLE Test PARTITION (ds) SELECT key, value, value FROM src;
      SELECT * FROM test;

      The following is copied from the processing log

      Loading data to table default.test partition (ds=null)
      Moved to trash: hdfs://localhost:8020/hive/warehouse/test/ds=1
      Moved to trash: hdfs://localhost:8020/hive/warehouse/test/ds=2
      Loading partition {ds=1}

      Loading partition

      {ds=2}

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mohanraj mohan dharmarajan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: