rangareddy commented on issue #17311:
URL: https://github.com/apache/hudi/issues/17311#issuecomment-5504704565

   Re-checked against `master` at `a2788eef922e`. **Recommend closing this as 
superseded by HUDI-8823.**
   
   The behaviour reported here cannot happen any more. HUDI-8568 was filed 
2024-11-23 describing a silent wrong result: update the partition column, get 
the old value back with no error. Six weeks later HUDI-8823, "Ban update query 
from changing partition column value", resolved that by rejecting the statement 
outright. It is **Closed/Fixed**, and it landed in `6b4c8f3308dd` ("[HUDI-8823] 
Ban update from updating primary key and partition key", #12587, 2025-01-14).
   
   On current `master`, an UPDATE that assigns to a partition field throws 
`HoodieAnalysisException` before any write happens:
   
   
https://github.com/apache/hudi/blob/a2788eef922e2375432ead3fe50af7fe5f55faf7/hudi-spark-datasource/hudi-spark3-common/src/main/scala/org/apache/spark/sql/hudi/command/UpdateHoodieTableCommand.scala#L132-L139
   
   The Spark 4 copy carries the same check, and the behaviour is pinned by a 
test at `TestUpdateTable.scala:419-428`, so the repro in the description now 
fails fast rather than returning `(1,1,"a")`.
   
   Two consequences worth stating explicitly, since they affect what should 
happen to this ticket rather than to the code:
   
   - Patching this issue as written would mean removing a deliberate, tested 
restriction. That is a design reversal, not a bug fix, and belongs on `dev@` 
rather than in a drive-by PR. If cross-partition UPDATE is still wanted, it is 
cleaner to reopen it as a feature request that references HUDI-8823, so the 
reviewer sees the ban is being lifted on purpose.
   - Moving a record across partitions from SQL is already supported today via 
MERGE INTO with a global index and the matching `update.partition.path` config 
enabled. See `MergeIntoHoodieTableCommand.scala:306-317` and the 
index-to-config map at `:1197-1201`.
   
   One small piece of residue if this stays open in any form: the rejection 
message says "Please remove the assignment clause to avoid the error", which 
does not tell a user what to do instead. Naming the MERGE INTO route there 
would save the next person the trip to this ticket.
   


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