jackylee-ch opened a new pull request, #10370:
URL: https://github.com/apache/paimon/pull/10370

   ### Purpose
   
   `CanalRecordParser` matched each new row image in a canal `UPDATE` event to 
its old image
   through a `Collectors.toMap` keyed by the row `JsonNode`. A single `UPDATE` 
batch can
   legitimately carry two equal row images — a table without a primary key, or 
a bulk
   `UPDATE ... SET col = const` that leaves several rows with identical values 
— and the
   duplicate key then made `toMap` throw `IllegalStateException: Duplicate 
key`, failing the
   whole sync job. The map was also rebuilt once per row (O(n^2)).
   
   New and old images are positional in canal, so this pairs the i-th new row 
with the i-th
   old row directly. The result is identical for distinct rows and no longer 
crashes on equal
   ones.
   
   ### Tests
   
   `CanalRecordParserTest#testUpdateWithDuplicateRowImagesPairsByPosition` 
feeds an `UPDATE`
   with two equal `data` rows and asserts a DELETE + INSERT per row (4 
records); it threw
   `Duplicate key` before the change.
   
   ### API and Format
   
   No change.
   
   ### Documentation
   
   No change.
   


-- 
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]

Reply via email to