Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry: (0) scalar_builder.go:148: cannot map variable %d to an indexed var | 7 (1) statement: SELECT _._, _._, _._, _._ FROM _ AS _ INNER JOIN _ AS _ ON _._ = _._ WHERE ((((_._ = _) AND EXISTS (SELECT _._ FROM _ AS _ WHERE ((_._ = _) OR (_._ = _)) AND (_._ = _._))) OR ((_._ = _) AND EXISTS (SELECT _._ FROM _ AS _ WHERE ((_._ = _) AND (_._ = _)) AND (_._ IS _)))) OR ((_._ = _) AND (NOT EXISTS (SELECT _._ FROM _ AS _ WHERE (_._ = _) AND (_._ = _))))) GROUP BY _._, _._, _._, _._ ORDER BY _._, _._, _._ (see stack traces in additional data) #43572

Closed
cockroach-teamcity opened this issue Dec 27, 2019 · 1 comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.

Comments

@cockroach-teamcity
Copy link
Member

This issue was autofiled by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.

Sentry link: https://sentry.io/organizations/cockroach-labs/issues/1408091061/?referrer=webhooks_plugin

Panic message:

(0) scalar_builder.go:148: cannot map variable %d to an indexed var | 7
(1) statement: SELECT ., ., ., . FROM _ AS _ INNER JOIN _ AS _ ON . = . WHERE ((((. = ) AND EXISTS (SELECT . FROM _ AS _ WHERE ((._ = ) OR (._ = )) AND (._ = .))) OR ((. = ) AND EXISTS (SELECT . FROM _ AS _ WHERE ((._ = ) AND (._ = )) AND (._ IS )))) OR ((._ = ) AND (NOT EXISTS (SELECT . FROM _ AS _ WHERE (._ = ) AND (._ = _))))) GROUP BY ., ., ., . ORDER BY ., ., .
(see stack traces in additional data)

Stacktrace (expand for inline code snippets):

}
panic(pgerror.NewAssertionErrorf("cannot map variable %d to an indexed var", log.Safe(colID)))
}
in pkg/sql/opt/exec/execbuilder.(*Builder).indexedVar
) (tree.TypedExpr, error) {
return b.indexedVar(ctx, b.mem.Metadata(), *scalar.Private().(*opt.ColumnID)), nil
}
in pkg/sql/opt/exec/execbuilder.(*Builder).buildVariable
if fn := scalarBuildFuncMap[scalar.Op()]; fn != nil {
texpr, err := fn(b, ctx, scalar)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar
}
right, err := b.buildScalar(ctx, scalar.Child(1).(opt.ScalarExpr))
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildComparison
if fn := scalarBuildFuncMap[scalar.Op()]; fn != nil {
texpr, err := fn(b, ctx, scalar)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar
case opt.FiltersItemOp:
return b.buildScalar(ctx, scalar.Child(0).(opt.ScalarExpr))
in pkg/sql/opt/exec/execbuilder.(*Builder).buildBoolean
if fn := scalarBuildFuncMap[scalar.Op()]; fn != nil {
texpr, err := fn(b, ctx, scalar)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar
for i, n := 1, scalar.ChildCount(); i < n; i++ {
right, err := b.buildScalar(ctx, scalar.Child(i).(opt.ScalarExpr))
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildBoolean
if fn := scalarBuildFuncMap[scalar.Op()]; fn != nil {
texpr, err := fn(b, ctx, scalar)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar
ctx := input.makeBuildScalarCtx()
filter, err := b.buildScalar(&ctx, &sel.Filters)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildSelect
case *memo.SelectExpr:
ep, err = b.buildSelect(t)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
md := b.mem.Metadata()
input, err := b.buildRelational(prj.Input)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildProject
case *memo.ProjectExpr:
ep, err = b.buildProject(t)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
}
rightPlan, err = b.buildRelational(rightChild)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).initJoinBuild
left, right, onExpr, outputCols, err := b.initJoinBuild(
leftExpr,
in pkg/sql/opt/exec/execbuilder.(*Builder).buildHashJoin
if opt.IsJoinNonApplyOp(e) {
ep, err = b.buildHashJoin(e)
break
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
groupByInput := groupBy.Child(0).(memo.RelExpr)
input, err := b.buildRelational(groupByInput)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupByInput
func (b *Builder) buildGroupBy(groupBy memo.RelExpr) (execPlan, error) {
input, err := b.buildGroupByInput(groupBy)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupBy
case *memo.GroupByExpr, *memo.ScalarGroupByExpr:
ep, err = b.buildGroupBy(e)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
func (b *Builder) buildSelect(sel *memo.SelectExpr) (execPlan, error) {
input, err := b.buildRelational(sel.Input)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildSelect
case *memo.SelectExpr:
ep, err = b.buildSelect(t)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
) (leftPlan, rightPlan execPlan, onExpr tree.TypedExpr, outputCols opt.ColMap, _ error) {
leftPlan, err := b.buildRelational(leftChild)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).initJoinBuild
left, right, onExpr, outputCols, err := b.initJoinBuild(
leftExpr,
in pkg/sql/opt/exec/execbuilder.(*Builder).buildHashJoin
if opt.IsJoinNonApplyOp(e) {
ep, err = b.buildHashJoin(e)
break
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
func (b *Builder) buildSort(sort *memo.SortExpr) (execPlan, error) {
input, err := b.buildRelational(sort.Input)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildSort
case *memo.SortExpr:
ep, err = b.buildSort(t)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
groupByInput := groupBy.Child(0).(memo.RelExpr)
input, err := b.buildRelational(groupByInput)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupByInput
}
input, err := b.buildGroupByInput(distinct)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).buildDistinct
case *memo.DistinctOnExpr:
ep, err = b.buildDistinct(t)
in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational
}
plan, err := b.buildRelational(rel)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).build
root, err := b.build(b.e)
if err != nil {
in pkg/sql/opt/exec/execbuilder.(*Builder).Build
execFactory := makeExecFactory(p)
plan, err := execbuilder.New(&execFactory, execMemo, root, p.EvalContext()).Build()
if err != nil {
in pkg/sql.(*planner).makeOptimizerPlan
var err error
result, isCorrelated, err = planner.makeOptimizerPlan(ctx)
if err == nil {
in pkg/sql.(*connExecutor).makeExecPlan
// between here and there needs to happen even if there's an error.
err := ex.makeExecPlan(ctx, planner)
// We'll be closing the plan manually below after execution; this
in pkg/sql.(*connExecutor).dispatchToExecutionEngine
p.autoCommit = os.ImplicitTxn.Get() && !ex.server.cfg.TestingKnobs.DisableAutoCommit
if err := ex.dispatchToExecutionEngine(ctx, p, res); err != nil {
return nil, nil, err
in pkg/sql.(*connExecutor).execStmtInOpenState
} else {
ev, payload, err = ex.execStmtInOpenState(ctx, stmt, pinfo, res)
}
in pkg/sql.(*connExecutor).execStmt
stmtCtx := withStatement(ex.Ctx(), ex.curStmt)
ev, payload, err = ex.execStmt(stmtCtx, curStmt, stmtRes, nil /* pinfo */)
if err != nil {
in pkg/sql.(*connExecutor).run
}()
return h.ex.run(ctx, s.pool, reserved, cancel)
}
in pkg/sql.(*Server).ServeConn
reservedOwned = false // We're about to pass ownership away.
retErr = sqlServer.ServeConn(ctx, connHandler, reserved, cancelConn)
}()
in pkg/sql/pgwire.(*conn).processCommandsAsync.func1

pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).indexedVar at line 148
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildVariable at line 137
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar at line 94
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildComparison at line 229
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar at line 94
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildBoolean at line 212
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar at line 94
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildBoolean at line 186
pkg/sql/opt/exec/execbuilder/scalar_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildScalar at line 94
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildSelect at line 425
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 174
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildProject at line 462
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 177
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).initJoinBuild at line 718
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildHashJoin at line 649
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 242
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupByInput at line 908
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupBy at line 781
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 180
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildSelect at line 420
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 174
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).initJoinBuild at line 714
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildHashJoin at line 649
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 242
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildSort at line 1063
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 189
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildGroupByInput at line 908
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildDistinct at line 876
pkg/sql/opt/exec/execbuilder/relational_builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).buildRelational at line 183
pkg/sql/opt/exec/execbuilder/builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).build at line 89
pkg/sql/opt/exec/execbuilder/builder.go in pkg/sql/opt/exec/execbuilder.(*Builder).Build at line 77
pkg/sql/plan_opt.go in pkg/sql.(*planner).makeOptimizerPlan at line 163
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).makeExecPlan at line 991
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).dispatchToExecutionEngine at line 865
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmtInOpenState at line 456
pkg/sql/conn_executor_exec.go in pkg/sql.(*connExecutor).execStmt at line 102
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1186
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 436
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommandsAsync.func1 at line 580
Tag Value
Cockroach Release v19.1.4
Cockroach SHA: 51a6fde
Platform linux amd64
Distribution CCL
Environment v19.1.4
Command server
Go Version go1.11.6
# of CPUs 2
# of Goroutines 913
@cockroach-teamcity cockroach-teamcity added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report. labels Dec 27, 2019
@yuzefovich
Copy link
Member

Dup of #40590.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Projects
None yet
Development

No branches or pull requests

2 participants