[ 
https://issues.apache.org/jira/browse/HIVE-25404?focusedWorklogId=640966&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640966
 ]

ASF GitHub Bot logged work on HIVE-25404:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Aug/21 07:00
            Start Date: 24/Aug/21 07:00
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on a change in pull request #2568:
URL: https://github.com/apache/hive/pull/2568#discussion_r694551954



##########
File path: ql/src/test/queries/clientpositive/merge_partitioned_insert.q
##########
@@ -0,0 +1,19 @@
+--! qt:transactional
+
+drop table u;
+drop table t;

Review comment:
       I haven't found where is table `t` created but `t1` and `t2`.

##########
File path: ql/src/test/queries/clientpositive/merge_partitioned_insert.q
##########
@@ -0,0 +1,19 @@
+--! qt:transactional
+
+drop table u;
+drop table t;
+
+create table u(id integer);
+insert into u values(3);
+
+create table t1(id integer, value string default 'def');
+insert into t1 values(1,'xx');
+insert into t1 (id) values(2);
+
+merge into t1 t using u on t.id=u.id when not matched then insert (id) values 
(u.id);
+

Review comment:
       Do we have tests that checks the content of the target table after merge 
like `select * from t1` ?

##########
File path: ql/src/test/queries/clientpositive/merge_partitioned_insert.q
##########
@@ -0,0 +1,19 @@
+--! qt:transactional
+
+drop table u;
+drop table t;
+
+create table u(id integer);
+insert into u values(3);
+
+create table t1(id integer, value string default 'def');
+insert into t1 values(1,'xx');
+insert into t1 (id) values(2);
+
+merge into t1 t using u on t.id=u.id when not matched then insert (id) values 
(u.id);

Review comment:
       Adding `explain merge into t1 t using u on t.id=u.id when not matched 
then insert (id) values (u.id);` would help checking the right plan is 
generated. Thoughts?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 640966)
    Time Spent: 20m  (was: 10m)

> 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
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {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}
> #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}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to