Skip to content

SQL: panic in vam distinct #6803

@philrz

Description

@philrz
$ super -s -o tab1.sup -c "values {col0:5}" &&
super -vam -c "SELECT COUNT(DISTINCT 1) FROM 'tab1.sup' AS cor0;"

panic: distinct: invalid partial
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/opt/go/libexec/src/runtime/debug/stack.go:26 +0x5e
github.com/brimdata/super/runtime/sam/op.(*Catcher).Pull.func1()
	/Users/phil/work/super/runtime/sam/op/catcher.go:25 +0x3d
panic({0x70b3e60?, 0x743d000?})
	/usr/local/opt/go/libexec/src/runtime/panic.go:860 +0x13a
github.com/brimdata/super/runtime/vam/expr/agg.(*distinct).ConsumeAsPartial(0x2b448c698f0, {0x746a200, 0x2b4489120f0})
	/Users/phil/work/super/runtime/vam/expr/agg/distinct.go:48 +0x16c
github.com/brimdata/super/runtime/vam/op/aggregate.(*scalarAggregate).Pull.func1({0x2b448926070, 0x1, 0x4482e40?})
	/Users/phil/work/super/runtime/vam/op/aggregate/scalar.go:66 +0x92
github.com/brimdata/super/vector.Apply(0x0?, 0x7469fd0?, {0x2b448926070?, 0x2b44899f698?, 0x7210540?})
	/Users/phil/work/super/vector/apply.go:19 +0xf6
github.com/brimdata/super/runtime/vam/op/aggregate.(*scalarAggregate).Pull(0x2b448710b60, 0x0)
	/Users/phil/work/super/runtime/vam/op/aggregate/scalar.go:63 +0x89
github.com/brimdata/super/runtime/vam/op.(*Values).Pull(0x2b448c699b0, 0x0)
	/Users/phil/work/super/runtime/vam/op/values.go:27 +0x44
github.com/brimdata/super/runtime/vam.(*Materializer).Pull(0x2b44899fa10?, 0x99?)
	/Users/phil/work/super/runtime/vam/materialize.go:26 +0x27
github.com/brimdata/super/runtime/sam/op.(*Single).Pull(0x2b448c69a10, 0xa0?)
	/Users/phil/work/super/runtime/sam/op/mux.go:120 +0x33
github.com/brimdata/super/runtime/sam/op.(*Catcher).Pull(0x2b44899f9e8?, 0x25?)
	/Users/phil/work/super/runtime/sam/op/catcher.go:28 +0x5c
github.com/brimdata/super/runtime/exec.(*Query).Pull(0x42f5a7f?, 0x20?)
	/Users/phil/work/super/runtime/exec/query.go:49 +0x3c
github.com/brimdata/super/sbuf.CopyMux(0x2b44899fd08, {0x744bb40, 0x2b448c69a40})
	/Users/phil/work/super/sbuf/mux.go:39 +0x38
github.com/brimdata/super/cmd/super/root.(*Command).Run(0x2b448854488, {0x2b44854e0f0, 0x0, 0x0})
	/Users/phil/work/super/cmd/super/root/command.go:108 +0x9f9
github.com/brimdata/super/pkg/charm.path.run({0x2b448500a78, 0x1, 0x1}, {0x2b44854e0f0, 0x0, 0x0?})
	/Users/phil/work/super/pkg/charm/path.go:11 +0x7b
github.com/brimdata/super/pkg/charm.(*Spec).Exec(0x7652720, {0x2b44854e0d0, 0x3, 0x3})
	/Users/phil/work/super/pkg/charm/charm.go:74 +0x1fa
main.main()
	/Users/phil/work/super/cmd/super/main.go:39 +0x5b

Details

Repro is with super commit cbb4109, which is associated with the merge of the changes in #6633. The query above is a simplification of sqllogictest query aggregates/slt_good_17/q9979.

The expected result is returned without panic in sequential runtime.

$ super -version
Version: v0.1.0-23-gcbb41094c

$ super -sam -c "SELECT COUNT(DISTINCT 1) FROM 'tab1.sup' AS cor0;"
{COUNT:1}

We can also get the expected result without panic in vector runtime if we jump back to the commit right before the changes merged from #6633.

$ super -version
Version: v0.1.0-22-g1bced4402

$ super -vam -c "SELECT COUNT(DISTINCT 1) FROM 'tab1.sup' AS cor0;"
{COUNT:1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions