[
https://issues.apache.org/jira/browse/HIVE-26385?focusedWorklogId=792698&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-792698
]
ASF GitHub Bot logged work on HIVE-26385:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Jul/22 13:39
Start Date: 19/Jul/22 13:39
Worklog Time Spent: 10m
Work Description: kasakrisz commented on code in PR #3430:
URL: https://github.com/apache/hive/pull/3430#discussion_r924515510
##########
ql/src/test/results/clientpositive/llap/check_constraint.q.out:
##########
@@ -2519,23 +2519,23 @@ STAGE PLANS:
Map 7
Map Operator Tree:
TableScan
- alias: t
+ alias: tmerge
Review Comment:
In the past the statement
```
explain MERGE INTO tmerge as t using nonacid as s ON t.key = s.key
WHEN MATCHED AND s.key < 5 THEN DELETE
WHEN MATCHED AND s.key < 3 THEN UPDATE set a1 = '1'
WHEN NOT MATCHED THEN INSERT VALUES (s.key, s.a1, s.value)
```
was rewritten to
```
FROM
`tmerge` `t`
RIGHT OUTER JOIN
`default`.`nonacid` `s`
ON `t`.`key` = `s`.`key`
<insert branches>
```
In this patch I introduced a subquery because some of the target table
columns needed twice in case of iceberg target and it is generated in the same
way in case of updates.
```
FROM
(SELECT ROW__ID, `key`, `a1`, `value` FROM `default`.`tmerge`) `t`
RIGHT OUTER JOIN
`default`.`nonacid` `s`
ON `t`.`key` = `s`.`key`
<insert branches>
```
In both the new and the old plan TS you highlighted scans the same table:
tmerge
But in the old plane `tmerge` and `t` refers to the same object. In the new
plan the table does not have an alias so it is referenced by its name. The
alias `t` refers the subquery.
Issue Time Tracking
-------------------
Worklog Id: (was: 792698)
Time Spent: 1h 10m (was: 1h)
> Iceberg integration: Implement merge into iceberg table
> -------------------------------------------------------
>
> Key: HIVE-26385
> URL: https://issues.apache.org/jira/browse/HIVE-26385
> Project: Hive
> Issue Type: Improvement
> Components: File Formats
> Reporter: Krisztian Kasa
> Assignee: Krisztian Kasa
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> {code}
> create external table target_ice(a int, b string, c int) partitioned by spec
> (bucket(16, a), truncate(3, b)) stored by iceberg stored as orc tblproperties
> ('format-version'='2');
> create table source(a int, b string, c int);
> ...
> merge into target_ice as t using source src ON t.a = src.a
> when matched and t.a > 100 THEN DELETE
> when matched then update set b = 'Merged', c = t.c + 10
> when not matched then insert values (src.a, src.b, src.c);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)