Niklaus Xiao created HIVE-17080: ----------------------------------- Summary: Overwrite does not work when multi insert into same table different partition Key: HIVE-17080 URL: https://issues.apache.org/jira/browse/HIVE-17080 Project: Hive Issue Type: Bug Components: SQL Affects Versions: 2.3.0 Reporter: Niklaus Xiao Priority: Critical
Repo: {code} create table foo(k string, v string) partitioned by (dt string) stored as orc; insert into table foo partition(dt='00') values('k1', 'v1'); insert into table foo partition(dt='01') values('k2', 'v2'); {code} Run query: {code} from ( select * from foo ) t insert overwrite table foo partition(dt='00') select t.k, t.v where t.k = 'k1' insert into table foo partition(dt='01') select t.k, t.v where t.k = 'k2'; {code} Note that is overwrite for partition dt='00' expect result {code} 0: jdbc:hive2://localhost:10000/default> select * from foo; +--------+--------+---------+ | foo.k | foo.v | foo.dt | +--------+--------+---------+ | k1 | v1 | 00 | | k2 | v2 | 01 | | k2 | v2 | 01 | +--------+--------+---------+ 4 rows selected (0.125 seconds) {code} Actual result: {code} 0: jdbc:hive2://localhost:10000/default> select * from foo; +--------+--------+---------+ | foo.k | foo.v | foo.dt | +--------+--------+---------+ | k1 | v1 | 00 | | k1 | v1 | 00 | | k2 | v2 | 01 | | k2 | v2 | 01 | +--------+--------+---------+ 4 rows selected (0.125 seconds) {code} Explain result says MoveTask for partition dt = '0' repalce is false: {code} | Stage: Stage-0 | | Move Operator | | tables: | | partition: | | dt 00 | | replace: false | | table: | | input format: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat | | output format: org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat | | serde: org.apache.hadoop.hive.ql.io.orc.OrcSerde | | name: default.foo {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)