yevgenypats commented on code in PR #34986:
URL: https://github.com/apache/arrow/pull/34986#discussion_r1164365143
##########
go/arrow/array/numeric.gen.go.tmpl:
##########
@@ -82,6 +82,32 @@ func (a *{{.Name}}) setData(data *Data) {
}
}
+func (a *{{.Name}}) ValueStr(i int) string {
+ if a.IsNull(i) {
+ return NullValueStr
+ }
+{{if or (eq .Name "Date32") (eq .Name "Date64") -}}
+ return a.values[i].ToTime().Format("2006-01-02")
+{{else if or (eq .Name "Time32") (eq .Name "Time64") -}}
+ return
a.values[i].ToTime(a.DataType().(*{{.QualifiedType}}Type).Unit).Format("15:04:05.999999999")
+{{else if or (eq .Name "Timestamp") -}}
+ return
a.values[i].ToTime(a.DataType().(*{{.QualifiedType}}Type).Unit).Format("2006-01-02
15:04:05.999999999")
+{{else if (eq .Name "Duration") -}}
+ // return value and suffix as a string such as "12345ms"
+ return fmt.Sprintf("%d%s", a.values[i],
a.DataType().(*{{.QualifiedType}}Type).Unit.String())
+{{else if or (eq .Name "Int8") (eq .Name "Int16") (eq .Name "Int32") (eq .Name
"Int64") -}}
+ return strconv.FormatInt(int64(a.Value(i)), 10)
+{{else if or (eq .Name "Uint8") (eq .Name "Uint16") (eq .Name "Uint32") (eq
.Name "Uint64") -}}
+ return strconv.FormatUint(uint64(a.Value(i)), 10)
Review Comment:
not sure. I think it's more efficient and we also do the same in CSV
reader/writer but I don't mind changing it.
--
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]