dgvj-work commented on code in PR #1243:
URL: https://github.com/apache/arrow-go/pull/1243#discussion_r3900739572


##########
arrow/extensions/variant.go:
##########
@@ -225,6 +225,10 @@ func NewVariantType(storage arrow.DataType) (*VariantType, 
error) {
                dt = dt.(arrow.ExtensionType).StorageType()
        }
 
+       if dt.ID() == arrow.NULL {

Review Comment:
   Good catch. `NewShreddedVariantType(arrow.Null)` now returns the default 
non-shredded variant type, same as a nil argument, so callers always get a 
usable type.



##########
arrow/extensions/variant.go:
##########
@@ -295,7 +299,10 @@ func validStruct(s *arrow.StructType) bool {
        switch s.NumFields() {
        case 1:
                f := s.Field(0)
-               return (f.Name == "value" && isBinary(f.Type)) || f.Name == 
"typed_value"
+               if f.Name == "value" {
+                       return isBinary(f.Type)
+               }
+               return f.Name == "typed_value" && f.Type.ID() != arrow.NULL

Review Comment:
   Unwrapped extension storage before the Null checks in both the one-field and 
two-field nested `typed_value` forms, and added regression tests for those 
cases.



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