Skip to content

colexec: messed up batch type schema (probably with CASE operator - the implementation of OR) #48622

@kocoten1992

Description

@kocoten1992

Got this error when run a complicated query (query below)

ERROR: internal error: unexpected error from the vectorized engine: trying to add a column of bool type at index 6 but batch has width 2
SQLSTATE: XX000
DETAIL: stack trace:
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:91: func1()
/usr/local/go/src/runtime/panic.go:679: gopanic()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:179: InternalError()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colmem/allocator.go:194: MaybeAppendColumn()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/operator.go:303: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/const.eg.go:149: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/simple_project.go:124: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/hashjoiner.go:353: exec()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/hashjoiner.go:241: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/disk_spiller.go:218: func1()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:94: CatchVectorizedRuntimeError()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/disk_spiller.go:216: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/simple_project.go:124: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/hash_aggregator.go:234: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:157: next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:148: nextAdapter()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:94: CatchVectorizedRuntimeError()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:185: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/rowexec/noop.go:69: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:112: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:157: next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:148: nextAdapter()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:94: CatchVectorizedRuntimeError()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:185: Next()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/execinfra/base.go:170: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/execinfra/processorsbase.go:748: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/flowinfra/flow.go:369: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:407: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1017: PlanAndRun()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:891: execWithDistSQLEngine()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:782: dispatchToExecutionEngine()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:485: execStmtInOpenState()

HINT: You have encountered an unexpected error.

Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.

If you would rather not post publicly, please contact us directly
using the support form.

We appreciate your feedback.
select "name" from "biseqs" where (not exists (select * from "endpoints" inner join "biseq_endpoint" on "endpoints"."id" = "biseq_endpoint"."endpoint_id" where "biseqs"."id" = "biseq_endpoint"."biseq_id" and "endpoints"."deleted_at" is null for share) or ((select count(*) from "biseq_pieces" where "biseqs"."id" = "biseq_pieces"."biseq_id") = "biseqs"."max_split" or exists (select * from "biseq_pieces" where "biseqs"."id" = "biseq_pieces"."biseq_id" and not exists (select * from "endpoints" inner join "biseq_piece_endpoint" on "endpoints"."id" = "biseq_piece_endpoint"."endpoint_id" where "biseq_pieces"."id" = "biseq_piece_endpoint"."biseq_piece_id" and "endpoints"."deleted_at" is null for share) and not exists (select * from "accounts" inner join "account_biseq_piece" on "accounts"."id" = "account_biseq_piece"."account_id" where "biseq_pieces"."id" = "account_biseq_piece"."biseq_piece_id" and "accounts"."deleted_at" is null for share)))) for share;

version

Build Tag:    e35af53
Build Time:   2020/05/08 21:27:47
Distribution: CCL
Platform:     linux amd64 (x86_64-pc-linux-gnu)
Go Version:   go1.13.9
C Compiler:   4.2.1 Compatible Clang 3.8.0 (tags/RELEASE_380/final)
Build SHA-1:  e35af53cffd031392da36040529b42af77d17ad1
Build Type:   development

Let me know if we need database schema.

Metadata

Metadata

Assignees

Labels

O-communityOriginated from the communityX-blathers-triagedblathers was able to find an owner

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions