zeroshade commented on code in PR #1243:
URL: https://github.com/apache/arrow-go/pull/1243#discussion_r3908657265


##########
arrow/extensions/variant.go:
##########
@@ -291,11 +291,25 @@ func isBinary(dt arrow.DataType) bool {
                dt.ID() == arrow.BINARY_VIEW
 }
 
+func storageType(dt arrow.DataType) arrow.DataType {
+       if ext, ok := dt.(arrow.ExtensionType); ok {
+               return ext.StorageType()

Review Comment:
   This unwraps only one extension layer. A double-wrapped Null such as 
`Opaque(Opaque(Null))` therefore bypasses both one- and two-field nested 
`typed_value` validation: `NewVariantType` succeeds, but builder creation then 
panics on the unsupported extension type; the shredded constructor can return 
nil after discarding the later construction error. Please recursively unwrap 
extension storage with cycle protection and add double-wrapped regressions for 
direct, one-field, two-field, and shredded construction.



##########
arrow/extensions/variant.go:
##########
@@ -291,11 +291,25 @@ func isBinary(dt arrow.DataType) bool {
                dt.ID() == arrow.BINARY_VIEW
 }
 
+func storageType(dt arrow.DataType) arrow.DataType {
+       if ext, ok := dt.(arrow.ExtensionType); ok {
+               return ext.StorageType()
+       }
+       return dt
+}
+
+func isNullType(dt arrow.DataType) bool {
+       return storageType(dt).ID() == arrow.NULL

Review Comment:
   This dereferences the result of `storageType` without handling nil. Because 
`NewOpaqueType(nil, ...)` is public, using such a type as `typed_value` 
currently panics here instead of returning `arrow.ErrInvalid`, including 
through `NewShreddedVariantType`. Please make extension-storage unwrapping 
nil-safe, reject malformed storage in the error-returning constructor, and 
ensure the shredded convenience constructor remains non-panicking.



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