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

Alter table Exchange partition with multiple partition_spec is not working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.0, 1.2.0, 2.0.0
    • 1.2.2, 1.3.0, 2.0.0
    • Metastore
    • None

    Description

      Single partition works, but multiple partitions will not work.
      Reproduce steps:

      DROP TABLE IF EXISTS t1;
      DROP TABLE IF EXISTS t2;
      DROP TABLE IF EXISTS t3;
      DROP TABLE IF EXISTS t4;
      
      CREATE TABLE t1 (a int) PARTITIONED BY (d1 int);
      CREATE TABLE t2 (a int) PARTITIONED BY (d1 int);
      CREATE TABLE t3 (a int) PARTITIONED BY (d1 int, d2 int);
      CREATE TABLE t4 (a int) PARTITIONED BY (d1 int, d2 int);
      
      INSERT OVERWRITE TABLE t1 PARTITION (d1 = 1) SELECT salary FROM jsmall LIMIT 10;
      INSERT OVERWRITE TABLE t3 PARTITION (d1 = 1, d2 = 1) SELECT salary FROM jsmall LIMIT 10;
      
      SELECT * FROM t1;
      
      SELECT * FROM t3;
      
      ALTER TABLE t2 EXCHANGE PARTITION (d1 = 1) WITH TABLE t1;
      SELECT * FROM t1;
      SELECT * FROM t2;
      
      ALTER TABLE t4 EXCHANGE PARTITION (d1 = 1, d2 = 1) WITH TABLE t3;
      SELECT * FROM t3;
      SELECT * FROM t4;
      

      The output:

      0: jdbc:hive2://10.17.74.148:10000/default> SELECT * FROM t3;
      +-------+--------+--------+--+
      | t3.a  | t3.d1  | t3.d2  |
      +-------+--------+--------+--+
      +-------+--------+--------+--+
      No rows selected (0.227 seconds)
      0: jdbc:hive2://10.17.74.148:10000/default> SELECT * FROM t4;
      +-------+--------+--------+--+
      | t4.a  | t4.d1  | t4.d2  |
      +-------+--------+--------+--+
      +-------+--------+--------+--+
      No rows selected (0.266 seconds)
      

      Attachments

        1. HIVE-11745.2.patch
          12 kB
          Yongzhi Chen
        2. HIVE-11745.1.patch
          9 kB
          Yongzhi Chen

        Issue Links

          Activity

            People

              ychena Yongzhi Chen
              ychena Yongzhi Chen
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: