ggodik commented on code in PR #13772:
URL: https://github.com/apache/arrow/pull/13772#discussion_r935574971


##########
go/arrow/csv/writer.go:
##########
@@ -188,6 +188,35 @@ func (w *Writer) Write(record arrow.Record) error {
                                        recs[i][j] = w.nullValue
                                }
                        }
+               case *arrow.Date32Type:
+                       arr := col.(*array.Date32)
+                       for i := 0; i < arr.Len(); i++ {
+                               if arr.IsValid(i) {
+                                       recs[i][j] = 
arr.Value(i).FormattedString()
+                               } else {
+                                       recs[i][j] = w.nullValue
+                               }
+                       }
+               case *arrow.Date64Type:
+                       arr := col.(*array.Date64)
+                       for i := 0; i < arr.Len(); i++ {
+                               if arr.IsValid(i) {
+                                       recs[i][j] = 
arr.Value(i).FormattedString()
+                               } else {
+                                       recs[i][j] = w.nullValue
+                               }
+                       }
+
+               case *arrow.TimestampType:
+                       arr := col.(*array.Timestamp)
+                       t := w.schema.Field(j).Type.(*arrow.TimestampType)
+                       for i := 0; i < arr.Len(); i++ {
+                               if arr.IsValid(i) {
+                                       recs[i][j] = 
arr.Value(i).ToTime(t.Unit).Format("2006-01-02 15:04:05.999999999")

Review Comment:
   Ideally I'd have 
[TimestampFromStringInLocation](https://github.com/apache/arrow/blob/4bd3d2ecbb6f4f311d59098892b7dca5421c15e4/go/arrow/datatype_fixedwidth.go#L108)
  but in reverse  or 
[FormattedString()](https://github.com/apache/arrow/blob/4bd3d2ecbb6f4f311d59098892b7dca5421c15e4/go/arrow/datatype_fixedwidth.go#L102)
 like on `Date32` or `Date64`



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