Zoltan Haindrich created HIVE-25404:
---------------------------------------
Summary: Inserts inside merge statements are rewritten incorrectly
for partitioned tables
Key: HIVE-25404
URL: https://issues.apache.org/jira/browse/HIVE-25404
Project: Hive
Issue Type: Bug
Reporter: Zoltan Haindrich
{code}
drop table u;drop table t;
create table t(value string default 'def') partitioned by (id integer);
create table u(id integer);
{code}
#1 id&value specified
rewritten
{code}
FROM
`default`.`t`
RIGHT OUTER JOIN
`default`.`u`
ON `t`.`id`=`u`.`id`
INSERT INTO `default`.`t` (`id`,`value`) partition (`id`) -- insert clause
SELECT `u`.`id`,'x'
WHERE `t`.`id` IS NULL
{code}
it should be
{code}
[...]
INSERT INTO `default`.`t` partition (`id`) (`value`) -- insert clause
[...]
{code}
#2 when values is not specified
{code}
merge into t using u on t.id=u.id when not matched then insert (id) values
(u.id);
{code}
rewritten query:
{code}
FROM
`default`.`t`
RIGHT OUTER JOIN
`default`.`u`
ON `t`.`id`=`u`.`id`
INSERT INTO `default`.`t` (`id`) partition (`id`) -- insert clause
SELECT `u`.`id`
WHERE `t`.`id` IS NULL
{code}
it should be
{code}
[...]
INSERT INTO `default`.`t` partition (`id`) () -- insert clause
[...]
{code}
however we don't accept empty column lists
--
This message was sent by Atlassian Jira
(v8.3.4#803005)