You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/09/06 13:51:00 UTC

[jira] [Work logged] (HIVE-25404) Inserts inside merge statements are rewritten incorrectly for partitioned tables

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

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

                Author: ASF GitHub Bot
            Created on: 06/Sep/21 13:50
            Start Date: 06/Sep/21 13:50
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk merged pull request #2568:
URL: https://github.com/apache/hive/pull/2568


   


-- 
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-unsubscribe@hive.apache.org

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


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

    Worklog Id:     (was: 646992)
    Time Spent: 1h  (was: 50m)

> 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: 1h
>  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}
> right now it causes an exception like:
> {code}
> See ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log, or check ./ql/target/surefire-reports or ./itests/qtest/target/surefire-reports/ for specific test cases logs.
>  org.apache.hadoop.hive.ql.parse.SemanticException: Encountered parse error while parsing rewritten merge/update or delete query
> 	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.parseRewrittenQuery(RewriteSemanticAnalyzer.java:277)
> 	at org.apache.hadoop.hive.ql.parse.MergeSemanticAnalyzer.analyzeMerge(MergeSemanticAnalyzer.java:272)
> 	at org.apache.hadoop.hive.ql.parse.MergeSemanticAnalyzer.analyze(MergeSemanticAnalyzer.java:63)
> 	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyzeInternal(RewriteSemanticAnalyzer.java:72)
> 	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:317)
> 	at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:223)
> [...]
> Caused by: org.apache.hadoop.hive.ql.parse.ParseException: line 6:34 cannot recognize input near 'partition' '(' 'id' in select clause
> 	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:125)
> 	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:93)
> 	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:85)
> 	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.parseRewrittenQuery(RewriteSemanticAnalyzer.java:275)
> {code}
> because the query is rewritten to
> #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)