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

Alter table partition rename with location - moves partition back to hive warehouse

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 1.3.0, 2.3.0, 3.0.0, 2.4.0
    • Component/s: Metastore
    • Labels:
      None
    • Environment:

      RHEL 6.8

      Description

      I was renaming my partition in a table that I've created using the location clause, and noticed that when after rename is completed, my partition is moved to the hive warehouse (hive.metastore.warehouse.dir).

      create table test_local_part (col1 int) partitioned by (col2 int) location '/tmp/testtable/test_local_part';
      insert into test_local_part partition (col2=1) values (1),(3);
      insert into test_local_part partition (col2=2) values (3);
      alter table test_local_part partition (col2='1') rename to partition (col2='4');

      Running:
      describe formatted test_local_part partition (col2='2')

      1. Detailed Partition Information
        Partition Value: [2]
        Database: default
        Table: test_local_part
        CreateTime: Mon Mar 20 13:25:28 PDT 2017
        LastAccessTime: UNKNOWN
        Protect Mode: None
        Location: hdfs://my.server.com:8020/tmp/testtable/test_local_part/col2=2

      Running:
      describe formatted test_local_part partition (col2='4')

      1. Detailed Partition Information
        Partition Value: [4]
        Database: default
        Table: test_local_part
        CreateTime: Mon Mar 20 13:24:53 PDT 2017
        LastAccessTime: UNKNOWN
        Protect Mode: None
        Location: hdfs://my.server.com:8020/apps/hive/warehouse/test_local_part/col2=4


      Per Sergio's comment - "The rename should create the new partition name in the same location of the table. "

        Attachments

        1. HIVE-16287-addedum.06.patch
          2 kB
          Vihang Karajgaonkar
        2. HIVE-16287.branch-1.01.patch
          15 kB
          Vihang Karajgaonkar
        3. HIVE-16287.05-branch-1.patch
          15 kB
          Vihang Karajgaonkar
        4. HIVE-16287.04.patch
          18 kB
          Vihang Karajgaonkar
        5. HIVE-16287.03.patch
          18 kB
          Vihang Karajgaonkar
        6. HIVE-16287.02.patch
          18 kB
          Vihang Karajgaonkar
        7. HIVE-16287.01.patch
          4 kB
          Vihang Karajgaonkar

          Activity

            People

            • Assignee:
              vihangk1 Vihang Karajgaonkar
              Reporter:
              ying1 Ying Chen
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified