You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "zhangshenghang (via GitHub)" <gi...@apache.org> on 2026/09/28 14:06:46 UTC
[PR] [Fix][API] Copy the arrays passed to the SeaTunnelRowType constructor [seatunnel]
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][API] Copy the arrays passed to the SeaTunnelRowType constructor [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12527:
URL: https://github.com/apache/seatunnel/pull/12527
--
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-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org