candiduslynx commented on code in PR #35457:
URL: https://github.com/apache/arrow/pull/35457#discussion_r1187630688


##########
go/internal/types/extension_types.go:
##########
@@ -208,37 +199,49 @@ type UUIDType struct {
 // NewUUIDType is a convenience function to create an instance of UuidType
 // with the correct storage type
 func NewUUIDType() *UUIDType {
-       return &UUIDType{
-               ExtensionBase: arrow.ExtensionBase{
-                       Storage: &arrow.FixedSizeBinaryType{ByteWidth: 16}}}
+       return &UUIDType{ExtensionBase: arrow.ExtensionBase{Storage: 
&arrow.FixedSizeBinaryType{ByteWidth: 16}}}
 }
 
-// ArrayType returns TypeOf(UuidArray) for constructing uuid arrays
-func (UUIDType) ArrayType() reflect.Type { return reflect.TypeOf(UUIDArray{}) }
+// ArrayType returns TypeOf(UUIDArray{}) for constructing UUID arrays
+func (*UUIDType) ArrayType() reflect.Type {
+       return reflect.TypeOf(UUIDArray{})
+}
+
+func (*UUIDType) ExtensionName() string {
+       return "uuid"
+}
+
+func (e *UUIDType) String() string {
+       return fmt.Sprintf("extension_type<storage=%s>", e.Storage)
+}
 
-func (UUIDType) ExtensionName() string { return "uuid" }
+func (e *UUIDType) MarshalJSON() ([]byte, error) {
+       return []byte(fmt.Sprintf(`{"name":"%s","metadata":%s}`, 
e.ExtensionName(), e.Serialize())), nil
+}
 
 // Serialize returns "uuid-serialized" for testing proper metadata passing
-func (UUIDType) Serialize() string { return "uuid-serialized" }
+func (*UUIDType) Serialize() string {
+       return "uuid-serialized"
+}
 
 // Deserialize expects storageType to be FixedSizeBinaryType{ByteWidth: 16} 
and the data to be
-// "uuid-serialized" in order to correctly create a UUIDType for testing 
deserialize.
-func (UUIDType) Deserialize(storageType arrow.DataType, data string) 
(arrow.ExtensionType, error) {
-       if string(data) != "uuid-serialized" {
-               return nil, fmt.Errorf("type identifier did not match: '%s'", 
string(data))
+// "uuid-serialized" in order to correctly create a UuidType for testing 
deserialize.

Review Comment:
   Done in 3e314138add5174886bb3c7c507d7ac0ae4f104b



##########
go/internal/types/extension_types.go:
##########
@@ -208,37 +199,49 @@ type UUIDType struct {
 // NewUUIDType is a convenience function to create an instance of UuidType
 // with the correct storage type
 func NewUUIDType() *UUIDType {
-       return &UUIDType{
-               ExtensionBase: arrow.ExtensionBase{
-                       Storage: &arrow.FixedSizeBinaryType{ByteWidth: 16}}}
+       return &UUIDType{ExtensionBase: arrow.ExtensionBase{Storage: 
&arrow.FixedSizeBinaryType{ByteWidth: 16}}}
 }
 
-// ArrayType returns TypeOf(UuidArray) for constructing uuid arrays
-func (UUIDType) ArrayType() reflect.Type { return reflect.TypeOf(UUIDArray{}) }
+// ArrayType returns TypeOf(UUIDArray{}) for constructing UUID arrays
+func (*UUIDType) ArrayType() reflect.Type {
+       return reflect.TypeOf(UUIDArray{})
+}
+
+func (*UUIDType) ExtensionName() string {
+       return "uuid"
+}
+
+func (e *UUIDType) String() string {
+       return fmt.Sprintf("extension_type<storage=%s>", e.Storage)
+}
 
-func (UUIDType) ExtensionName() string { return "uuid" }
+func (e *UUIDType) MarshalJSON() ([]byte, error) {
+       return []byte(fmt.Sprintf(`{"name":"%s","metadata":%s}`, 
e.ExtensionName(), e.Serialize())), nil
+}
 
 // Serialize returns "uuid-serialized" for testing proper metadata passing
-func (UUIDType) Serialize() string { return "uuid-serialized" }
+func (*UUIDType) Serialize() string {
+       return "uuid-serialized"
+}
 
 // Deserialize expects storageType to be FixedSizeBinaryType{ByteWidth: 16} 
and the data to be
-// "uuid-serialized" in order to correctly create a UUIDType for testing 
deserialize.
-func (UUIDType) Deserialize(storageType arrow.DataType, data string) 
(arrow.ExtensionType, error) {
-       if string(data) != "uuid-serialized" {
-               return nil, fmt.Errorf("type identifier did not match: '%s'", 
string(data))
+// "uuid-serialized" in order to correctly create a UuidType for testing 
deserialize.
+func (*UUIDType) Deserialize(storageType arrow.DataType, data string) 
(arrow.ExtensionType, error) {
+       if data != "uuid-serialized" {
+               return nil, fmt.Errorf("type identifier did not match: '%s'", 
data)
        }
        if !arrow.TypeEqual(storageType, &arrow.FixedSizeBinaryType{ByteWidth: 
16}) {
-               return nil, fmt.Errorf("invalid storage type for UUIDType: %s", 
storageType.Name())
+               return nil, fmt.Errorf("invalid storage type for UuidType: %s", 
storageType.Name())

Review Comment:
   Done in 3e314138add5174886bb3c7c507d7ac0ae4f104b



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