Skip to content

Panic on GROUP BY with ordinals against a * projection #7296

Description

@philrz
$ echo '{foo: "bar"}' > data.sup &&
  super -version &&
  super -static -c "SELECT * FROM data.sup GROUP BY 1"

Version: v0.3.0-384-gf69c8b488

panic: (*ast.StarExpr) 0x2f815453b440
goroutine 1 [running]:
github.com/brimdata/super/compiler/semantic.(*translator).expr(0x2f815425eea0, {0xff66ab8?, 0x2f815453b440}, {0xff5fa20, 0x2f8154343110})
	/Users/phil/work/super/compiler/semantic/expr.go:403 +0x1d0a
github.com/brimdata/super/compiler/semantic.(*translator).groupBy(0x2f815425eea0, 0x2f815446d900, {0x2f81542a7a60?, 0x1?, 0x20?}, {0xff5fa20, 0x2f8154343110})
	/Users/phil/work/super/compiler/semantic/sql.go:677 +0x4fa
github.com/brimdata/super/compiler/semantic.(*translator).sqlSelect(0x2f815425eea0, 0x2f815446d4a0, {0x0, 0x0, 0x0?}, {0x0?, 0x0?, 0x0?}, {0xff5f980, 0x101ffce0})
	/Users/phil/work/super/compiler/semantic/sql.go:61 +0x5a5
github.com/brimdata/super/compiler/semantic.(*translator).sqlQueryBody(0x2f8154544708?, {0xff66188?, 0x2f815446d4a0?}, {0x0?, 0xfe24fc0?, 0x0?}, {0x0?, 0x0?, 0x101c8c30?}, {0xff5f980, ...})
	/Users/phil/work/super/compiler/semantic/sql.go:440 +0x2d8
github.com/brimdata/super/compiler/semantic.(*translator).sqlQueryBody(0x2f815425eea0, {0xff65cd8?, 0x2f81542fe4b0}, {0x0?, 0x0?, 0x0?}, {0x0, 0x0, 0x0}, {0xff5f980, ...})
	/Users/phil/work/super/compiler/semantic/sql.go:452 +0x101b
github.com/brimdata/super/compiler/semantic.(*translator).semOp(0x2f815425eea0, {0xff66788?, 0x2f81543420c0}, {0x0, 0x0, 0x0}, {0xff5f980, 0x101ffce0})
	/Users/phil/work/super/compiler/semantic/op.go:594 +0x33fe
github.com/brimdata/super/compiler/semantic.(*translator).seq(0x2f815425eea0, {0x2f81542a7ca0?, 0x2f815435e340?, 0x2f815425ee10?}, {0xff5f980?, 0x101ffce0?})
	/Users/phil/work/super/compiler/semantic/op.go:42 +0x13b
github.com/brimdata/super/compiler/semantic.Analyze({0xff6b328?, 0x2f8154342930?}, 0x2f815429f020, 0x2f8154342810?, 0x5?)
	/Users/phil/work/super/compiler/semantic/analyzer.go:27 +0x30b
github.com/brimdata/super/compiler.Analyze(...)
	/Users/phil/work/super/compiler/package.go:23
github.com/brimdata/super/compiler.CompileWithAST(0x2f8154342930, 0x32?, 0x10?, 0x1, 0xc, {0x0?, 0x2f8154342930?, 0x2f8154610008?})
	/Users/phil/work/super/compiler/package.go:68 +0x25a
github.com/brimdata/super/compiler.(*compiler).NewQuery(0x30?, 0xfeee060?, 0x2f81545b3880?, {0x0?, 0x2f8154610008?, 0x2f81546105a8?}, 0x1f8?)
	/Users/phil/work/super/compiler/compiler.go:42 +0x45
github.com/brimdata/super/runtime.CompileQuery({0xff6b3d0?, 0x2f8154316a00?}, 0x2f81542fe500, {0xff5f750, 0x2f81546862b8}, 0x2f815429f020, {0x0, 0x0, 0x0})
	/Users/phil/work/super/runtime/compiler.go:31 +0x119
github.com/brimdata/super/cmd/super/root.(*Command).Run(0x2f815444c200, {0x2f81542840b0, 0x0, 0x0})
	/Users/phil/work/super/cmd/super/root/command.go:95 +0x648
github.com/brimdata/super/pkg/charm.path.run({0x2f8154686240, 0x1, 0x1}, {0x2f81542840b0, 0x0, 0x0?})
	/Users/phil/work/super/pkg/charm/path.go:11 +0x7b
github.com/brimdata/super/pkg/charm.(*Spec).Exec(0x1017a7d0, {0x2f8154284090, 0x3, 0x3})
	/Users/phil/work/super/pkg/charm/charm.go:74 +0x1fa
main.main()
	/Users/phil/work/super/cmd/super/main.go:40 +0x5b

Details

Repro is with super commit f69c8b4.

Claude happened to bump into this as it was finding another problem, but this one happens to repro on tip of main. It offered this brief explanation for root cause, should that help:

groupBy resolves an ordinal by re-translating sch.columns[colno-1].astExpr (compiler/semantic/sql.go:682), which for a star projection is the * itself, and translator.expr panics on an ast.StarExpr.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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