dgvj-work commented on code in PR #1243:
URL: https://github.com/apache/arrow-go/pull/1243#discussion_r3910664002
##########
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:
Updated `storageType` to unwrap extensions recursively, with a seen-set so a
cycle just returns nil. Double-wrapped Null is now rejected for direct
`NewVariantType`, both nested forms, and `NewShreddedVariantType`.
##########
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:
`storageType` is now nil-safe. `NewVariantType` returns `arrow.ErrInvalid`
for an Opaque with nil storage, and `NewShreddedVariantType` falls back to the
default type instead of 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]