Skip to content

distsql: simple projection in experimental distsql planner panics#78213

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
msirek:simpleProjectPanic
Mar 22, 2022
Merged

distsql: simple projection in experimental distsql planner panics#78213
craig[bot] merged 1 commit intocockroachdb:masterfrom
msirek:simpleProjectPanic

Conversation

@msirek
Copy link
Copy Markdown
Contributor

@msirek msirek commented Mar 21, 2022

Previously, selecting a given column from a table more than once could
cause an index out of range panic when experimental_distsql_planning
is set to always, for example:

CREATE TABLE kv (k INT PRIMARY KEY, v INT);
INSERT INTO kv VALUES (1, 1), (2, 1), (3, 2);
SET experimental_distsql_planning = always;
SELECT v, k, k, v FROM kv;

This commit fixes the issue, which is due to incorrect mapping of
selected columns to source column ordinals in
ConstructSimpleProject.

Release note: none

@msirek msirek requested review from cucaroach and yuzefovich March 21, 2022 23:00
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@msirek msirek force-pushed the simpleProjectPanic branch from b03b8f3 to 2070408 Compare March 21, 2022 23:07
Previously, selecting a given column from a table more than once could
cause an `index out of range` panic when experimental_distsql_planning
is set to always, for example:
```
CREATE TABLE kv (k INT PRIMARY KEY, v INT);
INSERT INTO kv VALUES (1, 1), (2, 1), (3, 2);
SET experimental_distsql_planning = always;
SELECT v, k, k, v FROM kv;
```
This commit fixes the issue, which is due to incorrect mapping of
selected columns to source column ordinals in
`ConstructSimpleProject`.

Release note: none
@msirek msirek force-pushed the simpleProjectPanic branch from 2070408 to 92e940c Compare March 21, 2022 23:50
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! :lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @cucaroach)

@msirek msirek requested a review from a team March 22, 2022 04:08
Copy link
Copy Markdown
Contributor

@cucaroach cucaroach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:LGTM:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @msirek)

@rytaft
Copy link
Copy Markdown
Collaborator

rytaft commented Mar 22, 2022

Is there an open issue for this? Should this be backported?

@yuzefovich
Copy link
Copy Markdown
Member

No need to backport this since it's encountered only when an experimental setting is turned on.

Copy link
Copy Markdown
Contributor Author

@msirek msirek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no github issue, I just found this while testing another PR.

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @msirek)

Copy link
Copy Markdown
Contributor Author

@msirek msirek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTRs!
bors r+

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @msirek)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 22, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 22, 2022

Build succeeded:

@craig craig bot merged commit e1e6f39 into cockroachdb:master Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants