zeroshade commented on code in PR #34585:
URL: https://github.com/apache/arrow/pull/34585#discussion_r1142673122


##########
go/arrow/csv/transformer.go:
##########
@@ -225,6 +227,52 @@ func (w *Writer) transformColToStringArr(typ 
arrow.DataType, col arrow.Array) []
                                res[i] = w.nullValue
                        }
                }
+       case arrow.ExtensionType:
+               arr := col.(array.ExtensionArray)
+               b, err := arr.MarshalJSON()
+               if err != nil {
+                       panic(fmt.Errorf("arrow/csv: could not marshal 
extension array: %w", err))
+               }
+               var stringArr []interface{}
+               if err := json.Unmarshal(b, &stringArr); err != nil {
+                       panic(fmt.Errorf("arrow/csv: could not unmarshal 
extnesion to string array: %s", err))
+               }

Review Comment:
   why marshal to json and then back? 
   
   I'd much prefer a new method added to an ExtensionType or the 
`ExtensionArray` interface that implements `Value(int) fmt.Stringer` to allow 
customized retrieval as whatever type is desired and requiring it to have a 
`String() string` method so it can just be printed out here.



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