You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an application that adds columns dynamically, and it causes a panic when there are more than 16384 rows in the collection being updated.
Here is what I am trying to do, structured as a test case in column_test.go:
func TestUpdate(t *testing.T) {
coll := NewCollection()
// set up an initial column of data
coll.CreateColumn("foo", ForString())
// up to 16384 it works, but at 16385
// it panics
for i := 0; i < 16385; i++ {
coll.Insert(func(row Row) error {
row.SetString("foo", fmt.Sprintf("foo-%d", i))
return nil
})
}
// set up a derived column of data
coll.CreateColumn("bar", ForString())
coll.Query(func(txn *Txn) error {
src := txn.String("foo")
dest := txn.String("bar")
txn.Range(func(_ uint32) {
if value, ok := src.Get(); ok {
dest.Set("bar-" + value[4:])
}
})
return nil
})
}
here's the whole stack trace:
dkolbly@RT7NV42324:~/misc/column$ go test -run TestUpdate
--- FAIL: TestUpdate (0.01s)
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 36 [running]:
testing.tRunner.func1.2({0x100b41da0, 0x14000120318})
/usr/local/go/src/testing/testing.go:1526 +0x1c8
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1529 +0x384
panic({0x100b41da0, 0x14000120318})
/usr/local/go/src/runtime/panic.go:884 +0x204
github.com/kelindar/column.chunks[...].chunkAt(...)
/Users/dkolbly/misc/column/column.go:290
github.com/kelindar/column.(*columnString).Apply(0x140001442c0?, 0x0?, 0x14000114240?)
/Users/dkolbly/misc/column/column_strings.go:173 +0x308
github.com/kelindar/column.(*column).Apply(0x14000106b58?, 0x182c8?, 0x14000106b58?)
/Users/dkolbly/misc/column/column.go:189 +0xe8
github.com/kelindar/column.(*Txn).commitUpdates.func1(0x14000120300?)
/Users/dkolbly/misc/column/txn.go:571 +0x3c
github.com/kelindar/column/commit.(*Reader).Range(0x14000114240, 0x1400012e550, 0x1, 0x1400014bc60)
/Users/dkolbly/misc/column/commit/reader.go:303 +0x168
github.com/kelindar/column.(*Txn).commitUpdates(0x140001a2090, 0x1)
/Users/dkolbly/misc/column/txn.go:570 +0x1b4
github.com/kelindar/column.(*Txn).commit.func2(0x1768a10ef9fbaccb, 0x1, {0x14000185800?, 0x1009dce30?, 0x14000106d78?})
/Users/dkolbly/misc/column/txn.go:530 +0x58
github.com/kelindar/column.(*Txn).rangeWrite.func1(0x1)
/Users/dkolbly/misc/column/txn_lock.go:92 +0x208
github.com/kelindar/bitmap.Bitmap.Range({0x1400011c600, 0x1, 0x14000106e18?}, 0x1400014bdf8)
/Users/dkolbly/go/pkg/mod/github.com/kelindar/[email protected]/range.go:33 +0x108
github.com/kelindar/column.(*Txn).rangeWrite(0x140001a2090?, 0x14000000001?)
/Users/dkolbly/misc/column/txn_lock.go:80 +0x58
github.com/kelindar/column.(*Txn).commit(0x140001a2090)
/Users/dkolbly/misc/column/txn.go:524 +0x178
github.com/kelindar/column.(*Collection).Query(0x1400013c420, 0x100b5f938)
/Users/dkolbly/misc/column/collection.go:362 +0x108
github.com/kelindar/column.TestUpdate(0x0?)
/Users/dkolbly/misc/column/column_test.go:764 +0xfc
testing.tRunner(0x1400010d380, 0x100b5f9d0)
/usr/local/go/src/testing/testing.go:1576 +0x10c
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1629 +0x368
exit status 2
FAIL github.com/kelindar/column 0.810s
The text was updated successfully, but these errors were encountered:
This fixes issue #89 which was due to an improperly initialized capacity
for new columns, occurring when inserting large number of rows that
exceed initial capacity and then creating a column. The initial capacity
was set, not the current collection capacity, resulting in an incorrect
number passed to `Grow()` method.
I have an application that adds columns dynamically, and it causes a panic when there are more than 16384 rows in the collection being updated.
Here is what I am trying to do, structured as a test case in
column_test.go
:here's the whole stack trace:
The text was updated successfully, but these errors were encountered: