kasakrisz commented on PR #6924:
URL: https://github.com/apache/hive/pull/6924#issuecomment-6916681152

   @deniskuzZ 
   I have two questions regarding this point:
   >MERGE with UPDATE and DELETE clauses on V3: one delete branch 
(SplitMergeRewriter ORs the clauses' conditions); the update's insert branch is 
not counted, rows affected unchanged
   
   1. Can merging into native ACID and Iceberg v2 tables with both delete and 
delete of update branches work the same way?
   The delete branches (one for update and one for delete) never overlap. The 
combined branch could have a predicate like A OR B, so it would delete the 
exact same rows as the two separate branches. On disk, native ACID would write 
one delete delta per statement instead of two, and Iceberg v2 would write one 
set of position-delete files instead of two. This would mean fewer small files 
and a less complex `SplitMergeRewriter`, since only the single-delete-branch 
implementation would be needed.
   2. If `1.` is a no-go, can the special code for handling update-deletes and 
delete-deletes in the same branch be extracted into another 
`SplitMergeRewriter`?
   The decision about which one to instantiate could be made in 
`MergeRewriterFactory`:
   ```
     } else if (splitUpdate) {
       if (hasDistributeKeys(table)) {  // storageHandler != null && 
!acidDistributeColumns(table, DELETE).isEmpty()
           return new SingleDeleteBranchMergeRewriter(db, conf, 
sqlGeneratorFactory)
       } else {
           return new SplitMergeRewriter(db, conf, sqlGeneratorFactory);
       }
     }
   ``` 


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to