buraksenn opened a new pull request, #24483: URL: https://github.com/apache/datafusion/pull/24483
## Which issue does this PR close? - Part of #24170. ## Rationale for this change Several logical and physical plan protobuf paths convert wire integers to `usize` with unchecked casts. On 32-bit targets, values above `u32::MAX` silently truncate. For row limits, a fetch of `1 << 32` becomes `0`, causing a plan that should return rows to return an empty result. The reverse conversion can also truncate when a 64-bit `usize` does not fit the protobuf field. ## What changes are included in this PR? - Add shared helpers for checked conversions between wire integers and `usize`, with errors identifying the plan node and field. - Apply checked conversions to limits, partition counts, batch sizes, capacities, and indexes across logical and physical plan serialization. - Preserve the documented `-1` sentinel for limits without a fetch. - Reject invalid zero batch sizes while preserving proto3 defaults for older `FilterExec` payloads. - Treat out-of-range `usize` statistics as unknown rather than truncating them. The protobuf wire format is unchanged. Follow-up work will make common protobuf option and constraint conversions fallible. ## Are these changes tested? Yes. Added unit and protobuf roundtrip coverage for checked conversions, architecture-dependent integer boundaries, oversized encode/decode values, limits without a fetch, malformed zero-column `Values` nodes, and zero batch sizes. ## Are there any user-facing changes? Out-of-range plan integers now return a clear planning error instead of silently truncating. Invalid zero batch sizes are rejected, and out-of-range statistics become unknown. There are no breaking public API or protobuf wire-format changes. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
