[ 
https://issues.apache.org/jira/browse/HUDI-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17384085#comment-17384085
 ] 

ASF GitHub Bot commented on HUDI-2139:
--------------------------------------

pengzhiwei2018 commented on a change in pull request #3230:
URL: https://github.com/apache/hudi/pull/3230#discussion_r673022844



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieAppendHandle.java
##########
@@ -189,8 +191,14 @@ protected boolean isUpdateRecord(HoodieRecord<T> 
hoodieRecord) {
   private Option<IndexedRecord> getIndexedRecord(HoodieRecord<T> hoodieRecord) 
{
     Option<Map<String, String>> recordMetadata = 
hoodieRecord.getData().getMetadata();
     try {
-      Option<IndexedRecord> avroRecord = 
hoodieRecord.getData().getInsertValue(tableSchema,
-          config.getProps());
+      // Pass the isUpdateRecord to the props for HoodieRecordPayload to judge
+      // Whether it is a update or insert record.
+      boolean isUpdateRecord = isUpdateRecord(hoodieRecord);
+      Properties newProperties = new Properties();

Review comment:
       Make sense to me.




-- 
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: commits-unsubscr...@hudi.apache.org

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


> MergeInto MOR Table May Result InCorrect Result
> -----------------------------------------------
>
>                 Key: HUDI-2139
>                 URL: https://issues.apache.org/jira/browse/HUDI-2139
>             Project: Apache Hudi
>          Issue Type: Bug
>          Components: Spark Integration
>            Reporter: pengzhiwei
>            Assignee: pengzhiwei
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> Currently we process all the update-action and inert-action in the 
> ExpressionPayload#
> getInsertValue without know whether the record is matched or not matched for 
> MOR table. This may result in incorrect merge result. e.g.
> {code:java}
> Merge into h0
> using (select 2 as id, 'a1' as name, 10 as price from s) s0
> on h0.id = s0.id
> when matched then s0.id = 1 the update set id = s0.id, name = s0.name, price 
> = 10
> when not matched then s0.id = 2 the insert (id,name,price) values(id,name, 
> 20){code}
> If the id = 2 can matched the target table h0,  but it cannot match the 
> udpate-condition ( s0.id = 1),  It should not update the table. However, 
> currently we cannot know the matched state of the input record, it will goes 
> to the not-matched actions and update the price to 20 finally. This is 
> incorrect.



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

Reply via email to