You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/07/27 20:30:48 UTC
[PR] fix(parquet/schema): reject invalid fixed lengths [arrow-go]
fallintoplace opened a new pull request, #1035:
URL: https://github.com/apache/arrow-go/pull/1035
### Rationale for this change
Fixed-length byte-array constructors reject non-positive widths, but `PrimitiveNode.SetTypeLength` allowed an existing valid node to be mutated to zero or a negative width. The invalid node could then be serialized or passed to encoders.
### What changes are included in this PR?
* Reject non-positive widths when mutating fixed-length byte-array nodes.
* Leave non-fixed-width primitive nodes unchanged, preserving the existing no-op behavior.
* Document the panic contract on the setter.
### Are these changes tested?
Yes. The regression test covers zero and negative widths, verifies that failed mutations preserve the previous width, and checks the existing no-op behavior for other physical types. The full `parquet/schema` package passes.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet/schema): reject invalid fixed lengths [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #1035:
URL: https://github.com/apache/arrow-go/pull/1035#discussion_r3660790408
##########
parquet/schema/node.go:
##########
@@ -319,10 +319,13 @@ func (p *PrimitiveNode) Equals(rhs Node) bool {
// to store the values in this column.
func (p *PrimitiveNode) PhysicalType() parquet.Type { return p.physicalType }
-// SetTypeLength will change the type length of the node, has no effect if the
-// physical type is not FixedLength Byte Array
+// SetTypeLength will change the type length of the node, and has no effect if the
+// physical type is not FixedLength Byte Array. It panics if length is not positive.
func (p *PrimitiveNode) SetTypeLength(length int) {
if p.PhysicalType() == parquet.Types.FixedLenByteArray {
+ if length <= 0 {
+ panic("parquet: fixed length byte array length must be positive")
+ }
Review Comment:
Placement is right — inside the FLBA branch, so non-fixed-width primitives keep their documented no-op behavior, and the guard precedes the assignment so a rejected call leaves `typeLen` untouched (your test asserts exactly that).
This also makes the setter agree with `NewFixedLenByteArrayNode` at line 627, which already panics on the same condition through `MustPrimitive`. Worth noting the payoff concretely: without this, `toThrift` at line 360 would happily serialize a negative `type_length` into the footer.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(parquet/schema): reject invalid fixed lengths [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #1035:
URL: https://github.com/apache/arrow-go/pull/1035
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org