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

Use of COLLATE in a statement bundle stats file causes error during injection #77353

Closed
smcvey opened this issue Mar 3, 2022 · 0 comments · Fixed by #96695
Closed

Use of COLLATE in a statement bundle stats file causes error during injection #77353

smcvey opened this issue Mar 3, 2022 · 0 comments · Fixed by #96695
Assignees
Labels
A-sql-table-stats Table statistics (and their automatic refresh). C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team

Comments

@smcvey
Copy link
Contributor

smcvey commented Mar 3, 2022

If you generate a statement bundle, and one of the histogram buckets has a reference to a collation, then when injecting those stats later, it fails.

           {
                "distinct_range": ...,
                "num_eq": ...,
                "num_range": ...,
                "upper_bound": "e''\\x01....\x00 '' COLLATE en_US_u_ks_level2"
            },

Importing:

ERROR: internal error: expected a tree.CastExpr, but found *tree.CollateExpr
SQLSTATE: XX000
DETAIL: stack trace:
/go/src/github.com/cockroachdb/cockroach/pkg/sql/parser/parse.go:392: GetTypeFromValidSQLSyntax()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/stats/json.go:132: GetHistogram()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/alter_table.go:1251: injectTableStats()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/alter_table.go:900: startExec()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:508: func2()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:119: func1()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:296: visitInternal()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:86: visit()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/walk.go:50: walkPlan()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan.go:511: startExec()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:135: Start()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:156: Init()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:91: CatchVectorizedRuntimeError()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/colexec/materializer.go:273: Start()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/execinfra/processorsbase.go:780: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/flowinfra/flow.go:388: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:528: Run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1176: PlanAndRun()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1235: execWithDistSQLEngine()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:926: dispatchToExecutionEngine()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:669: execStmtInOpenState()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:125: execStmt()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1548: func1()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1550: execCmd()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1471: run()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:495: ServeConn()
/go/src/github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:628: func1()
/usr/local/go/src/runtime/asm_amd64.s:1374: goexit()

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.

Jira issue: CRDB-13545

Epic CRDB-14510

@smcvey smcvey added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Mar 3, 2022
@michae2 michae2 added the T-sql-queries SQL Queries Team label Nov 23, 2022
@michae2 michae2 added the A-sql-table-stats Table statistics (and their automatic refresh). label Nov 23, 2022
@mgartner mgartner added the E-quick-win Likely to be a quick win for someone experienced. label Jan 19, 2023
@yuzefovich yuzefovich self-assigned this Feb 6, 2023
@craig craig bot closed this as completed in 58297f3 Feb 22, 2023
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-table-stats Table statistics (and their automatic refresh). C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants