cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

opt: project required ordering for EXPLAIN to input columns

Open DrewKimball opened this issue 3 years ago • 1 comments

Previously, EXPLAIN operators could require an ordering on non-output columns from their enclosed expression, which causes a panic. This could happen after column-pruning rules fired. This commit modifies the order-building logic to project the ordering required of the child of an EXPLAIN operator to only reference output columns.

Fixes #88037

Release note (bug fix): Fixed a longstanding bug that could cause a panic when running a query with EXPLAIN that attempts to order on a non-output column.

DrewKimball avatar Sep 22 '22 08:09 DrewKimball

This change is Reviewable

cockroach-teamcity avatar Sep 22 '22 08:09 cockroach-teamcity

Let's merge this to fix the sqlsmith failures.

bors r=mgartner,yuzefovich

yuzefovich avatar Sep 25 '22 18:09 yuzefovich

Build succeeded:

craig[bot] avatar Sep 25 '22 19:09 craig[bot]

@DrewKimball Should this be backported to the 22.2.0 branch? SQLancer might be running into the bug: https://github.com/sqlancer/sqlancer/pull/587#issuecomment-1281468873

mgartner avatar Oct 17 '22 20:10 mgartner

I wanted to avoid backporting a fix for an old bug, but it's had some time to bake at this point, so I guess we could. How much of a problem are the failures?

DrewKimball avatar Oct 17 '22 20:10 DrewKimball

Good point. They aren't a huge problem, we can ignore them in SQLancer until v22.2.1 is released.

mgartner avatar Oct 18 '22 14:10 mgartner