Skip to content

Commit e6d5651

Browse files
Merge pull request #385 from taniabogatsch/revert-pr
Revert PR #351 for v2
2 parents b6d394a + 9e42c5f commit e6d5651

File tree

2 files changed

+4
-40
lines changed

2 files changed

+4
-40
lines changed

appender_test.go

-37
Original file line numberDiff line numberDiff line change
@@ -933,40 +933,3 @@ func appendNestedData[T require.TestingT](t T, a *Appender, rowsToAppend []neste
933933
}
934934
require.NoError(t, a.Flush())
935935
}
936-
937-
var types = map[reflect.Type]string{
938-
reflect.TypeFor[int8](): "TINYINT",
939-
}
940-
941-
func benchmarkAppenderSingle[T any](v T) func(*testing.B) {
942-
return func(b *testing.B) {
943-
if _, ok := types[reflect.TypeFor[T]()]; !ok {
944-
b.Fatal("Type not defined in table:", reflect.TypeFor[T]())
945-
}
946-
tableSQL := fmt.Sprintf(createSingleTableSQL, types[reflect.TypeFor[T]()])
947-
c, db, conn, a := prepareAppender(b, tableSQL)
948-
defer cleanupAppender(b, c, db, conn, a)
949-
950-
const rowsToAppend = 2048
951-
vec := [rowsToAppend]T{}
952-
for i := 0; i < 2048; i++ {
953-
vec[i] = v
954-
}
955-
956-
b.ResetTimer()
957-
for n := 0; n < b.N; n++ {
958-
for i := 0; i < rowsToAppend; i++ {
959-
if err := a.AppendRow(v); err != nil {
960-
b.Error(err)
961-
}
962-
}
963-
}
964-
b.StopTimer()
965-
}
966-
}
967-
968-
func BenchmarkAppenderSingle(b *testing.B) {
969-
b.Run("int8", benchmarkAppenderSingle[int8](0))
970-
}
971-
972-
const createSingleTableSQL = `CREATE TABLE test (nested_int_list %s)`

data_chunk.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package duckdb
22

33
import "C"
44
import (
5-
"sync"
6-
75
"github.com/marcboeker/go-duckdb/mapping"
86
)
97

@@ -19,7 +17,10 @@ type DataChunk struct {
1917
size int
2018
}
2119

22-
var GetDataChunkCapacity = sync.OnceValue[int](func() int { return int(mapping.VectorSize()) })
20+
// GetDataChunkCapacity returns the capacity of a data chunk.
21+
func GetDataChunkCapacity() int {
22+
return int(mapping.VectorSize())
23+
}
2324

2425
// GetSize returns the internal size of the data chunk.
2526
func (chunk *DataChunk) GetSize() int {

0 commit comments

Comments
 (0)