raman118 opened a new pull request, #21109:
URL: https://github.com/apache/hudi/pull/21109

   ### Describe the issue this Pull Request addresses
   
   Closes #20999. On Spark 4.2, a filtered Dataset merged back into its own 
Hudi table can update every row when the source columns were resolved through 
the Dataset. The source and target share attribute IDs, so the merge condition 
can compare a target column with itself.
   
   ### Summary and Changelog
   
   Extend the existing nested-assignment safeguard to top-level updates. Check 
whether an expression still reads a shared attribute after Spark deduplicates 
the relations. Exclude assignment keys from this check because they identify 
the update destination. Preserve the pre-deduplication check for nested updates.
   
   ### Impact
   
   The analyzer rejects ambiguous self-updates and directs the caller to name 
source columns through their alias. This also applies to an already-resolved 
target read whose origin cannot be distinguished from the source. 
Alias-qualified updates still change only the matching rows.
   
   ### Risk Level
   
   Medium. The change affects merge analysis across Spark versions. On Spark 
4.2 the regression reproduced on the original code. A second regression 
captured source columns before aliasing the Dataset. The tests check that 
rejection leaves every row unchanged and that alias-qualified top-level and 
nested assignments succeed.
   
   The 18-module Maven build passed. The full Spark 4.2 `TestMergeIntoTable2` 
suite passed (95 succeeded, 1 ignored). Spark 4.0 and 4.1 were not run locally.
   
   ### Documentation Update
   
   Companion change for the SQL DML guide targets `asf-site` and describes how 
to reference source columns through their alias.
   
   ### Contributor's checklist
   
   - [x] Read through the contributor's guide
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added
   
   OpenAI Codex prepared the patch, ran the local checks and performed the 
independent agent review.
   


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