Skip to content

Instantly share code, notes, and snippets.

@metalmatze
Created May 22, 2023 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metalmatze/c2ed937e7508d4b940bbf26bef2dded2 to your computer and use it in GitHub Desktop.
Save metalmatze/c2ed937e7508d4b940bbf26bef2dded2 to your computer and use it in GitHub Desktop.
Add `Value(i int)` to `numericbuilder.gen.go.tmpl`
diff --git a/go/arrow/array/dictionary.go b/go/arrow/array/dictionary.go
index 3a46774e5..f796a4f69 100644
--- a/go/arrow/array/numericbuilder.gen.go
+++ b/go/arrow/array/numericbuilder.gen.go
@@ -143,6 +143,10 @@ func (b *Int64Builder) Resize(n int) {
}
}
+func (b *Int64Builder) Value(i int) int64 {
+ return b.rawData[i]
+}
+
// NewArray creates a Int64 array from the memory buffers used by the builder and resets the Int64Builder
// so it can be used to build a new array.
func (b *Int64Builder) NewArray() arrow.Array {
@@ -352,6 +356,10 @@ func (b *Uint64Builder) Resize(n int) {
}
}
+func (b *Uint64Builder) Value(i int) uint64 {
+ return b.rawData[i]
+}
+
// NewArray creates a Uint64 array from the memory buffers used by the builder and resets the Uint64Builder
// so it can be used to build a new array.
func (b *Uint64Builder) NewArray() arrow.Array {
@@ -561,6 +569,10 @@ func (b *Float64Builder) Resize(n int) {
}
}
+func (b *Float64Builder) Value(i int) float64 {
+ return b.rawData[i]
+}
+
// NewArray creates a Float64 array from the memory buffers used by the builder and resets the Float64Builder
// so it can be used to build a new array.
func (b *Float64Builder) NewArray() arrow.Array {
@@ -770,6 +782,10 @@ func (b *Int32Builder) Resize(n int) {
}
}
+func (b *Int32Builder) Value(i int) int32 {
+ return b.rawData[i]
+}
+
// NewArray creates a Int32 array from the memory buffers used by the builder and resets the Int32Builder
// so it can be used to build a new array.
func (b *Int32Builder) NewArray() arrow.Array {
@@ -979,6 +995,10 @@ func (b *Uint32Builder) Resize(n int) {
}
}
+func (b *Uint32Builder) Value(i int) uint32 {
+ return b.rawData[i]
+}
+
// NewArray creates a Uint32 array from the memory buffers used by the builder and resets the Uint32Builder
// so it can be used to build a new array.
func (b *Uint32Builder) NewArray() arrow.Array {
@@ -1188,6 +1208,10 @@ func (b *Float32Builder) Resize(n int) {
}
}
+func (b *Float32Builder) Value(i int) float32 {
+ return b.rawData[i]
+}
+
// NewArray creates a Float32 array from the memory buffers used by the builder and resets the Float32Builder
// so it can be used to build a new array.
func (b *Float32Builder) NewArray() arrow.Array {
@@ -1397,6 +1421,10 @@ func (b *Int16Builder) Resize(n int) {
}
}
+func (b *Int16Builder) Value(i int) int16 {
+ return b.rawData[i]
+}
+
// NewArray creates a Int16 array from the memory buffers used by the builder and resets the Int16Builder
// so it can be used to build a new array.
func (b *Int16Builder) NewArray() arrow.Array {
@@ -1606,6 +1634,10 @@ func (b *Uint16Builder) Resize(n int) {
}
}
+func (b *Uint16Builder) Value(i int) uint16 {
+ return b.rawData[i]
+}
+
// NewArray creates a Uint16 array from the memory buffers used by the builder and resets the Uint16Builder
// so it can be used to build a new array.
func (b *Uint16Builder) NewArray() arrow.Array {
@@ -1815,6 +1847,10 @@ func (b *Int8Builder) Resize(n int) {
}
}
+func (b *Int8Builder) Value(i int) int8 {
+ return b.rawData[i]
+}
+
// NewArray creates a Int8 array from the memory buffers used by the builder and resets the Int8Builder
// so it can be used to build a new array.
func (b *Int8Builder) NewArray() arrow.Array {
@@ -2024,6 +2060,10 @@ func (b *Uint8Builder) Resize(n int) {
}
}
+func (b *Uint8Builder) Value(i int) uint8 {
+ return b.rawData[i]
+}
+
// NewArray creates a Uint8 array from the memory buffers used by the builder and resets the Uint8Builder
// so it can be used to build a new array.
func (b *Uint8Builder) NewArray() arrow.Array {
@@ -2234,6 +2274,10 @@ func (b *TimestampBuilder) Resize(n int) {
}
}
+func (b *TimestampBuilder) Value(i int) arrow.Timestamp {
+ return b.rawData[i]
+}
+
// NewArray creates a Timestamp array from the memory buffers used by the builder and resets the TimestampBuilder
// so it can be used to build a new array.
func (b *TimestampBuilder) NewArray() arrow.Array {
@@ -2446,6 +2490,10 @@ func (b *Time32Builder) Resize(n int) {
}
}
+func (b *Time32Builder) Value(i int) arrow.Time32 {
+ return b.rawData[i]
+}
+
// NewArray creates a Time32 array from the memory buffers used by the builder and resets the Time32Builder
// so it can be used to build a new array.
func (b *Time32Builder) NewArray() arrow.Array {
@@ -2657,6 +2705,10 @@ func (b *Time64Builder) Resize(n int) {
}
}
+func (b *Time64Builder) Value(i int) arrow.Time64 {
+ return b.rawData[i]
+}
+
// NewArray creates a Time64 array from the memory buffers used by the builder and resets the Time64Builder
// so it can be used to build a new array.
func (b *Time64Builder) NewArray() arrow.Array {
@@ -2867,6 +2919,10 @@ func (b *Date32Builder) Resize(n int) {
}
}
+func (b *Date32Builder) Value(i int) arrow.Date32 {
+ return b.rawData[i]
+}
+
// NewArray creates a Date32 array from the memory buffers used by the builder and resets the Date32Builder
// so it can be used to build a new array.
func (b *Date32Builder) NewArray() arrow.Array {
@@ -3076,6 +3132,10 @@ func (b *Date64Builder) Resize(n int) {
}
}
+func (b *Date64Builder) Value(i int) arrow.Date64 {
+ return b.rawData[i]
+}
+
// NewArray creates a Date64 array from the memory buffers used by the builder and resets the Date64Builder
// so it can be used to build a new array.
func (b *Date64Builder) NewArray() arrow.Array {
@@ -3286,6 +3346,10 @@ func (b *DurationBuilder) Resize(n int) {
}
}
+func (b *DurationBuilder) Value(i int) arrow.Duration {
+ return b.rawData[i]
+}
+
// NewArray creates a Duration array from the memory buffers used by the builder and resets the DurationBuilder
// so it can be used to build a new array.
func (b *DurationBuilder) NewArray() arrow.Array {
diff --git a/go/arrow/array/numericbuilder.gen.go.tmpl b/go/arrow/array/numericbuilder.gen.go.tmpl
index baff618f0..3087a7fc4 100644
--- a/go/arrow/array/numericbuilder.gen.go.tmpl
+++ b/go/arrow/array/numericbuilder.gen.go.tmpl
@@ -147,6 +147,10 @@ func (b *{{.Name}}Builder) Resize(n int) {
}
}
+func (b *{{.Name}}Builder) Value(i int) {{or .QualifiedType .Type}} {
+ return b.rawData[i]
+}
+
// NewArray creates a {{.Name}} array from the memory buffers used by the builder and resets the {{.Name}}Builder
// so it can be used to build a new array.
func (b *{{.Name}}Builder) NewArray() arrow.Array {
diff --git a/go/arrow/math/float64_arm64.go b/go/arrow/math/float64_arm64.go
index 759d96747..8409fa566 100644
--- a/go/arrow/math/float64_arm64.go
+++ b/go/arrow/math/float64_arm64.go
@@ -21,7 +21,7 @@
package math
func initFloat64NEON() {
- Float64.sum = sum_float64_neon
+ Float64.sum = sum_float64_neon
}
func initFloat64Go() {
diff --git a/go/arrow/math/int64_arm64.go b/go/arrow/math/int64_arm64.go
index 917902be0..d5cd2dcab 100644
--- a/go/arrow/math/int64_arm64.go
+++ b/go/arrow/math/int64_arm64.go
@@ -21,7 +21,7 @@
package math
func initInt64NEON() {
- Int64.sum = sum_int64_neon
+ Int64.sum = sum_int64_neon
}
func initInt64Go() {
diff --git a/go/arrow/math/uint64_arm64.go b/go/arrow/math/uint64_arm64.go
index df87289df..13a6d15e3 100644
--- a/go/arrow/math/uint64_arm64.go
+++ b/go/arrow/math/uint64_arm64.go
@@ -21,7 +21,7 @@
package math
func initUint64NEON() {
- Uint64.sum = sum_uint64_neon
+ Uint64.sum = sum_uint64_neon
}
func initUint64Go() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment