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

sql: v21.2.6: expected *DArray, found tree.dNull when folding a comparison #77745

Closed
cockroach-teamcity opened this issue Mar 14, 2022 · 9 comments · Fixed by #77995
Closed
Assignees
Labels
A-sql-optimizer SQL logical planning and optimizations. 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. T-sql-queries SQL Queries Team

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Mar 14, 2022

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/3097249090/?referrer=webhooks_plugin

Panic message:

datum.go:3946: expected *DArray, found tree.dNull
--
*errutil.leafError: expected *DArray, found tree.dNull (1)
datum.go:3946: *withstack.withStack (top exception)
*assert.withAssertionFailure
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

if !ok {
panic(errors.AssertionFailedf("expected *DArray, found %T", e))
}
in pkg/sql/sem/tree.MustBeDArray
Fn: func(ctx *EvalContext, left Datum, right Datum) (Datum, error) {
needles := MustBeDArray(left)
haystack := MustBeDArray(right)
in pkg/sql/sem/tree.glob..func138
result, err := o.Fn(c.f.evalCtx, lDatum, rDatum)
if err != nil {
in pkg/sql/opt/norm.(*CustomFuncs).FoldComparison
https://github.com/cockroachdb/cockroach/blob/c7cfac57476f06e3154b2fc38e77982a8bbc64c2/pkg/sql/opt/norm/factory.og.go#L16765-L16767 in pkg/sql/opt/norm.(*Factory).ConstructContainedBy
https://github.com/cockroachdb/cockroach/blob/c7cfac57476f06e3154b2fc38e77982a8bbc64c2/pkg/sql/opt/norm/factory.og.go#L22243-L22245 in pkg/sql/opt/norm.(*Factory).Replace
}
return c.f.Replace(e, replace)
}
in pkg/sql/opt/norm.(*CustomFuncs).inlineConstants.func1
}
return replace(e)
}
in pkg/sql/opt/norm.(*CustomFuncs).inlineConstants
newProjections[i] = c.f.ConstructProjectionsItem(
c.inlineConstants(item.Element, input, constCols).(opt.ScalarExpr),
item.Col,
in pkg/sql/opt/norm.(*CustomFuncs).InlineProjectionConstants
https://github.com/cockroachdb/cockroach/blob/c7cfac57476f06e3154b2fc38e77982a8bbc64c2/pkg/sql/opt/norm/factory.og.go#L1348-L1350 in pkg/sql/opt/norm.(*Factory).ConstructProject
return b.factory.ConstructProject(input, projections, passthrough)
}
in pkg/sql/opt/optbuilder.(*Builder).constructProject
} else {
projectionsScope.expr = b.constructProject(
inScope.expr.(memo.RelExpr),
in pkg/sql/opt/optbuilder.(*Builder).constructProjectForScope
mb.b.constructProjectForScope(mb.outScope, projectionsScope)
mb.outScope = projectionsScope
in pkg/sql/opt/optbuilder.(*mutationBuilder).addCheckConstraintCols
// Add any check constraint boolean columns to the input.
mb.addCheckConstraintCols(false /* isUpdate */)
in pkg/sql/opt/optbuilder.(*mutationBuilder).buildInsert
// Build the final insert statement, including any returned expressions.
mb.buildInsert(returning)
in pkg/sql/opt/optbuilder.(*Builder).buildInsert
return b.processWiths(stmt.With, inScope, func(inScope *scope) *scope {
return b.buildInsert(stmt, inScope)
})
in pkg/sql/opt/optbuilder.(*Builder).buildStmt.func2
inScope.atRoot = false
outScope := buildStmt(inScope)
outScope.expr = b.buildWiths(outScope.expr, correlatedCTEs)
in pkg/sql/opt/optbuilder.(*Builder).processWiths
case *tree.Insert:
return b.processWiths(stmt.With, inScope, func(inScope *scope) *scope {
return b.buildInsert(stmt, inScope)
in pkg/sql/opt/optbuilder.(*Builder).buildStmt
b.ctes = nil
outScope = b.buildStmt(stmt, desiredTypes, inScope)
// Build With operators for any CTEs hoisted to the top level.
in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot
// and physical properties.
outScope := b.buildStmtAtRoot(b.stmt, nil /* desiredTypes */)
in pkg/sql/opt/optbuilder.(*Builder).Build
bld.KeepPlaceholders = true
if err := bld.Build(); err != nil {
return nil, err
in pkg/sql.(*optPlanningCtx).buildReusableMemo
memo, err := opc.buildReusableMemo(ctx)
if err != nil {
in pkg/sql.(*planner).prepareUsingOptimizer
// future.
flags, err := p.prepareUsingOptimizer(ctx)
if err != nil {
in pkg/sql.(*connExecutor).populatePrepared
p.semaCtx.Annotations = tree.MakeAnnotations(stmt.NumAnnotations)
flags, err = ex.populatePrepared(ctx, txn, placeholderHints, p)
return err
in pkg/sql.(*connExecutor).prepare.func1
// Use the existing transaction.
if err := prepare(ctx, txn); err != nil {
return nil, err
in pkg/sql.(*connExecutor).prepare
// Prepare the query. This completes the typing of placeholders.
prepared, err := ex.prepare(ctx, stmt, placeholderHints, rawTypeHints, origin)
if err != nil {
in pkg/sql.(*connExecutor).addPreparedStmt
stmt := makeStatement(parseCmd.Statement, ex.generateID())
ps, err := ex.addPreparedStmt(
ctx,
in pkg/sql.(*connExecutor).execPrepare
stmtCtx := withStatement(ctx, ex.curStmtAST)
ev, payload = ex.execPrepare(stmtCtx, tcmd)
case DescribeStmt:
in pkg/sql.(*connExecutor).execCmd
var err error
if err = ex.execCmd(ex.Ctx()); err != nil {
if errors.IsAny(err, io.EOF, errDrainingComplete) {
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
/usr/local/go/src/runtime/asm_amd64.s#L1370-L1372 in runtime.goexit

pkg/sql/sem/tree/datum.go in pkg/sql/sem/tree.MustBeDArray at line 3946
pkg/sql/sem/tree/eval.go in pkg/sql/sem/tree.glob..func138 at line 2567
pkg/sql/opt/norm/fold_constants_funcs.go in pkg/sql/opt/norm.(*CustomFuncs).FoldComparison at line 439
pkg/sql/opt/norm/factory.og.go in pkg/sql/opt/norm.(*Factory).ConstructContainedBy at line 16766
pkg/sql/opt/norm/factory.og.go in pkg/sql/opt/norm.(*Factory).Replace at line 22244
pkg/sql/opt/norm/inline_funcs.go in pkg/sql/opt/norm.(*CustomFuncs).inlineConstants.func1 at line 93
pkg/sql/opt/norm/inline_funcs.go in pkg/sql/opt/norm.(*CustomFuncs).inlineConstants at line 95
pkg/sql/opt/norm/inline_funcs.go in pkg/sql/opt/norm.(*CustomFuncs).InlineProjectionConstants at line 55
pkg/sql/opt/norm/factory.og.go in pkg/sql/opt/norm.(*Factory).ConstructProject at line 1349
pkg/sql/opt/optbuilder/project.go in pkg/sql/opt/optbuilder.(*Builder).constructProject at line 61
pkg/sql/opt/optbuilder/project.go in pkg/sql/opt/optbuilder.(*Builder).constructProjectForScope at line 36
pkg/sql/opt/optbuilder/mutation_builder.go in pkg/sql/opt/optbuilder.(*mutationBuilder).addCheckConstraintCols at line 908
pkg/sql/opt/optbuilder/insert.go in pkg/sql/opt/optbuilder.(*mutationBuilder).buildInsert at line 669
pkg/sql/opt/optbuilder/insert.go in pkg/sql/opt/optbuilder.(*Builder).buildInsert at line 288
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt.func2 at line 293
pkg/sql/opt/optbuilder/with.go in pkg/sql/opt/optbuilder.(*Builder).processWiths at line 111
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmt at line 292
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).buildStmtAtRoot at line 241
pkg/sql/opt/optbuilder/builder.go in pkg/sql/opt/optbuilder.(*Builder).Build at line 215
pkg/sql/plan_opt.go in pkg/sql.(*optPlanningCtx).buildReusableMemo at line 380
pkg/sql/plan_opt.go in pkg/sql.(*planner).prepareUsingOptimizer at line 123
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).populatePrepared at line 287
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare.func1 at line 220
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare at line 226
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).addPreparedStmt at line 111
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).execPrepare at line 53
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1797
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1629
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 668
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommandsAsync.func1 at line 648
/usr/local/go/src/runtime/asm_amd64.s in runtime.goexit at line 1371
Tag Value
Cockroach Release v21.2.6
Cockroach SHA: c7cfac5
Platform linux amd64
Distribution CCL
Environment v21.2.6
Command start-single-node
Go Version ``
# of CPUs
# of Goroutines

Jira issue: CRDB-13748

gz#11753

@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 Mar 14, 2022
@yuzefovich yuzefovich changed the title sentry: datum.go:3946: expected *DArray, found tree.dNull -- *errutil.leafError: expected *DArray, found tree.dNull (1) datum.go:3946: *withstack.withStack (top exception) *assert.withAssertionFailure (check the extra data payloads) sql: v21.2.6: expected *DArray, found tree.dNull when folding a comparison Mar 15, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Mar 15, 2022
@moogzy
Copy link

moogzy commented Mar 16, 2022

Hi Cockroach team,

We upgraded to 21.2.6 and have started to observe this error.

What's the mitigation here? What are we exposed to with this issue (i.e what's the impact to the cluster?)

@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

From the stack trace we can tell that this is caused by a query using the <@ operator which ends up with NULL on the left side when folding constants in the optimizer. (But of course NULL is a legal operand for <@ so I'm a little puzzled.)

It would help to have the query, if we can find it.

None of these cause the error, so it's not something obvious:

SELECT NULL <@ NULL;
SELECT NULL <@ ARRAY[]:::int[];
SELECT NULL <@ ARRAY[1];
SELECT (NULL <@ ARRAY[1]) <@ ARRAY[2];
SELECT a <@ ARRAY[1,2,3] FROM (VALUES (NULL)) AS v(a);

@michae2 michae2 self-assigned this Mar 16, 2022
@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

The other two sentry reports show an INSERT and an UPDATE so maybe we're looking for modifications to a table with an array column?

@mqdeandrade
Copy link

@michae2 for us it happens when inserting null into a nullable ARRAY column. Inserting an empty array doesn't exhibit the behaviour. Before the upgrade, null into a nullable ARRAY column worked without an issue.

@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

Aha, here's one way to hit it:

PREPARE s AS SELECT $1:::INT[] <@ $2:::INT[];
EXECUTE s (NULL, ARRAY[1]);
[email protected]:26257/defaultdb> EXECUTE s (NULL, ARRAY[1]);
ERROR: internal error: expected *DArray, found tree.dNull
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/datum.go:4233: MustBeDArray()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:2577: func138()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/fold_constants_funcs.go:465: FoldComparison()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:16862: ConstructContainedBy()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24052: CopyAndReplaceDefault()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:293: func2()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24859: invokeReplace()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24848: copyAndReplaceDefaultScalarListExpr()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:23889: CopyAndReplaceDefault()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:293: func2()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24859: invokeReplace()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24848: copyAndReplaceDefaultScalarListExpr()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:23548: CopyAndReplaceDefault()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:293: func2()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:24859: invokeReplace()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:252: CopyAndReplace()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.go:295: AssignPlaceholders()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:468: reuseMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:501: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:213: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1320: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1014: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:685: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:143: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1846: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1850: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1779: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:746: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:724: func1()
runtime/asm_amd64.s:1581: 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.

We appreciate your feedback.

@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

@mqdeandrade I see, thank you, that helps. Do you happen to have the SHOW CREATE TABLE? It looks like this might be related to a check constraint on the table.

@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

Thanks to @moogzy we saw that the table does indeed have a check constraint using <@ so this looks like a repro:

CREATE TABLE t (a STRING[] NULL, CHECK (a <@ ARRAY['x']));
INSERT INTO t VALUES (NULL);

Demonstration:

[email protected]:26257/defaultdb> INSERT INTO t VALUES (NULL);
ERROR: internal error: expected *DArray, found tree.dNull
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/datum.go:3946: MustBeDArray()
github.com/cockroachdb/cockroach/pkg/sql/sem/tree/eval.go:2567: func138()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/fold_constants_funcs.go:439: FoldComparison()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:16766: ConstructContainedBy()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:22244: Replace()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/inline_funcs.go:93: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/inline_funcs.go:95: inlineConstants()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/inline_funcs.go:55: InlineProjectionConstants()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:1349: ConstructProject()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/project.go:61: constructProject()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/project.go:36: constructProjectForScope()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/mutation_builder.go:908: addCheckConstraintCols()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/insert.go:669: buildInsert()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/insert.go:288: buildInsert()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:293: func2()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:111: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:292: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:241: buildStmtAtRoot()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:215: Build()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:521: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:194: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1260: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:972: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:709: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:129: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1705: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1707: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1629: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:668: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:648: func1()
runtime/asm_amd64.s:1581: 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.

We appreciate your feedback.

@michae2
Copy link
Collaborator

michae2 commented Mar 16, 2022

Interesting, this only reproduces for the <@ operator, when the column is first and a constant second, using both array and json. Not the @> operator or other array operators.

CREATE TABLE arraycontainedby (a STRING[], CHECK (a <@ ARRAY['x']));
CREATE TABLE arraycontainedbyrev (a STRING[], CHECK (ARRAY['x'] <@ a));
CREATE TABLE arraycontainedbyboth (a STRING[], CHECK (a <@ a));
CREATE TABLE arraycontains (a STRING[], CHECK (a @> ARRAY['x']));
CREATE TABLE arraycontainsrev (a STRING[], CHECK (ARRAY['x'] @> a));
CREATE TABLE arrayoverlaps (a STRING[], CHECK (a && ARRAY['x']));
CREATE TABLE jsoncontainedby (j JSONB, CHECK (j <@ '["x"]'::JSONB));
CREATE TABLE jsoncontainedbyrev (j JSONB, CHECK ('["x"]'::JSONB <@ j));
CREATE TABLE jsoncontainedbyboth (j JSONB, CHECK (j <@ j));
CREATE TABLE jsoncontains (j JSONB, CHECK (j @> '["x"]'::JSONB));
CREATE TABLE jsoncontainsrev (j JSONB, CHECK ('["x"]'::JSONB @> j));
CREATE TABLE jsonexists (j JSONB, CHECK (j ? 'x'));
CREATE TABLE intgt (i INT, CHECK (i > 0));

INSERT INTO arraycontainedby VALUES (NULL);      -- error
INSERT INTO arraycontainedbyrev VALUES (NULL);
INSERT INTO arraycontainedbyboth VALUES (NULL);
INSERT INTO arraycontains VALUES (NULL);
INSERT INTO arraycontainsrev VALUES (NULL);
INSERT INTO arrayoverlaps VALUES (NULL);
INSERT INTO jsoncontainedby VALUES (NULL);       -- error
INSERT INTO jsoncontainedbyrev VALUES (NULL);
INSERT INTO jsoncontainedbyboth VALUES (NULL);
INSERT INTO jsoncontains VALUES (NULL);
INSERT INTO jsoncontainsrev VALUES (NULL);
INSERT INTO jsonexists VALUES (NULL);
INSERT INTO intgt VALUES (NULL);

This suggests a simple workaround is to change CHECK (a <@ ARRAY[...]) to CHECK (ARRAY[...] @> a) while we figure out the problem.

@michae2
Copy link
Collaborator

michae2 commented Mar 17, 2022

Here's an even simpler repro:

SELECT NULL::STRING[] <@ ARRAY['x'];

(Apparently type checking has its own constant folding which was hiding this failure to constant fold in the optimizer.)

craig bot pushed a commit that referenced this issue Mar 17, 2022
77875: sql: use IndexFetchSpec for inverted joiner r=RaduBerinde a=RaduBerinde

#### rowexec: address TODO in inverted joiner

This commit addresses a TODO in the inverted joiner. We now reuse a
buffer for encoding the prefix key. In the general case we still need
to make a copy since we are storing multiple prefix keys; but now we
try to reuse the last copy if the prefix is the same.

We also remove the temporary use of `indexRow` which is confusing here
(it wasn't obvious at first but this code has nothing to do with index
rows and is just using `indexRow` as a temporary buffer).

Release note: None

#### geoindex: minor cleanup around Config

This change changes `IsEmptyConfig`, `IsGeographyConfig`,
`IsGeometryConfig` to methods on the `geoindex.Config` type.

We also switch to passing configs by value which is cleaner and avoids
some allocations.

Release note: None

#### sql: use IndexFetchSpec for inverted joiner

This commit reworks the InvertedJoiner to use an IndexFetchSpec
instead of table and index descriptors.

The "internal schema" now matches the fetched columns (leading to
simplifications in both planning and execution code).

Release note: None

77878: kvstreamer: re-enable streamer by default r=yuzefovich a=yuzefovich

Release note: None

77968: sql: keep experimental_enable_hash_sharded_indexes var as noop r=chengxiong-ruan a=chengxiong-ruan

Fixes #77954

Release justification: needed for session var backward compatibility.
Release note (sql change): experimental_enable_hash_sharded_indexes
used to be set to enable the hash sharded index feature. since we now
enable the feature by default, user don't need to set this var anymore.
But still keeping it as noop for backward compatibility.

77995: opt: add ContainedBy operator (<@) to FoldNullComparisonLeft norm rule r=msirek,mgartner a=michae2

Fixes: #77745

When we originally made the ContainedBy operator (<`@)` distinct from the
Contains operator (`@>)` we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.

78013: roachtest: fix handling of test panics r=erikgrinaker a=tbg

- roachtest: fix handling of test panics
- roachtest: gracefully fail in sst-corruption test


78023: roachprod: update thrift artifact url for use with charybdefs r=tbg a=nicktrav

The version of Thrift used in tests that use `charybdefs` has
disappeared from the Apache artifacts repository that is used currently,
which causes any roachtest that depends on `charybdefs` to fail due to
not being able to fetch the artifact it needs.

Update the artifact URL to pull from the Apache archive instead.

Touches #78006,#78007,#78008,#78010,#78015,#78016.

Release note: None.

Co-authored-by: Radu Berinde <[email protected]>
Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Chengxiong Ruan <[email protected]>
Co-authored-by: Michael Erickson <[email protected]>
Co-authored-by: Tobias Grieger <[email protected]>
Co-authored-by: Nick Travers <[email protected]>
@craig craig bot closed this as completed in 3765603 Mar 17, 2022
@craig craig bot closed this as completed in #77995 Mar 17, 2022
blathers-crl bot pushed a commit that referenced this issue Mar 17, 2022
Fixes: #77745

When we originally made the ContainedBy operator (<@) distinct from the
Contains operator (@>) we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.
michae2 added a commit that referenced this issue Mar 17, 2022
Fixes: #77745

When we originally made the ContainedBy operator (<@) distinct from the
Contains operator (@>) we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.

Release justification: high priority bug fix.
michae2 added a commit that referenced this issue Mar 17, 2022
Fixes: #77745

When we originally made the ContainedBy operator (<@) distinct from the
Contains operator (@>) we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.

Release justification: high priority bug fix.
michae2 added a commit that referenced this issue Mar 18, 2022
Fixes: #77745

When we originally made the ContainedBy operator (<@) distinct from the
Contains operator (@>) we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.
This bug was introduced in v21.2.0.

Release justification: high priority bug fix.
michae2 added a commit that referenced this issue Mar 18, 2022
Fixes: #77745

When we originally made the ContainedBy operator (<@) distinct from the
Contains operator (@>) we forgot to add ContainedBy to the
FoldNullComparisonLeft normalization rule. It was only added to the
FoldNullComparisonRight rule. Correct this.

Release note (bug fix): fix an optimizer bug that prevented expressions
of the form (NULL::STRING[] <@ ARRAY['x']) from being folded to NULL.
This bug was introduced in v21.2.0.

Release justification: high priority bug fix.
@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-optimizer SQL logical planning and optimizations. 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. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants