tanmayrauth commented on code in PR #1404:
URL: https://github.com/apache/iceberg-go/pull/1404#discussion_r3525805631
##########
types.go:
##########
@@ -558,7 +564,21 @@ func (m *MapType) UnmarshalJSON(b []byte) error {
return nil
}
-func FixedTypeOf(n int) FixedType { return FixedType{len: n} }
+func validateFixedLength(length int) error {
+ if length <= 0 {
+ return fmt.Errorf("invalid fixed length %d: must be greater
than 0", length)
+ }
+
+ return nil
+}
+
+func FixedTypeOf(n int) FixedType {
Review Comment:
Any reason to panic here rather than return an error like GeometryTypeOf /
GeographyTypeOf do? The two callers (this + arrow_utils.go:374 with
dt.ByteWidth) pass runtime-derived lengths, so a panic turns unusual external
input into a crash rather than a catchable error. Panic is fine if we're
confident those lengths are always validated upstream — just want to confirm
that's the case.
--
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]