Skip to content

Commit

Permalink
GH-35686:[Go] Add AppendTime to TimestampBuilder (#35687)
Browse files Browse the repository at this point in the history
### Rationale for this change

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* Closes: #35686

Lead-authored-by: candiduslynx <[email protected]>
Co-authored-by: Yevgeny Pats <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
  • Loading branch information
yevgenypats and yevgenypats authored May 25, 2023
1 parent 6e92623 commit 2d32efe
Show file tree
Hide file tree
Showing 14 changed files with 743 additions and 672 deletions.
2 changes: 1 addition & 1 deletion go/arrow/_tools/tmpl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func process(data interface{}, specs []pathSpec) {
}
}

ioutil.WriteFile(spec.out, generated, fileMode(spec.in))
os.WriteFile(spec.out, generated, fileMode(spec.in))
}
}

Expand Down
90 changes: 0 additions & 90 deletions go/arrow/array/numeric.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions go/arrow/array/numeric.gen.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ func (a *{{.Name}}) ValueStr(i int) string {
return a.values[i].FormattedString()
{{else if or (eq .Name "Time32") (eq .Name "Time64") -}}
return a.values[i].FormattedString(a.DataType().(*{{.QualifiedType}}Type).Unit)
{{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") -}}
{{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)
{{else if or (eq .Name "Int8") (eq .Name "Int16") (eq .Name "Int32") (eq .Name "Int64") -}}
Expand All @@ -116,9 +114,7 @@ func (a *{{.Name}}) GetOneForMarshal(i int) interface{} {
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") -}}
{{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 (eq .Size "1")}}
Expand Down
229 changes: 0 additions & 229 deletions go/arrow/array/numericbuilder.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d32efe

Please sign in to comment.