zhangshenghang opened a new pull request, #12527:
URL: https://github.com/apache/seatunnel/pull/12527

   ### Purpose of this pull request
   
   Close #12522.
   
   `new SeaTunnelRowType(fieldNames, fieldTypes)` stored the caller's arrays by 
reference, so any later mutation of those arrays silently changed the 
already-created type definition (field names, types and every `indexOf` 
lookup). `SeaTunnelRowType` is treated as an immutable type, so the constructor 
now copies both arrays with `Arrays.copyOf`. The getters keep returning the 
internal arrays directly to preserve existing behavior.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The only observable difference is that mutating the arrays passed to the 
constructor after construction no longer changes the row type, which was an 
undocumented aliasing hazard before.
   
   ### How was this patch tested?
   
   - Added `SeaTunnelRowTest#testRowTypeCopiesConstructorArrays`, which mutates 
the caller arrays after construction and asserts the type is unchanged.
   - `mvn -pl seatunnel-api test`: 402 tests, all passing.


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