-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: clean up of scanNode and some other things #49724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 15 of 15 files at r1, 15 of 15 files at r2, 7 of 7 files at r3.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)
pkg/sql/apply_join.go, line 264 at r1 (raw file):
planCtx := params.p.extendedEvalCtx.ExecCfg.DistSQLPlanner.newLocalPlanningCtx(params.ctx, evalCtx) // Always plan local. planCtx.isLocal = true
I don't think newLocalPlanningCtx
sets this field. Maybe it should?
pkg/sql/conn_executor_exec.go, line 866 at r1 (raw file):
var planCtx *PlanningCtx if distribute { planCtx = ex.server.cfg.DistSQLPlanner.NewPlanningCtx(ctx, evalCtx, planner.txn, distribute)
NewPlanningCtx
calls newLocalPlanningCtx
. We should be able to remove this if distribute
check here and everywhere and have NewPlanningCtx
behave identically to the old behavior
pkg/sql/distsql_physical_planner.go, line 3253 at r1 (raw file):
ctx context.Context, evalCtx *extendedEvalContext, txn *kv.Txn, distribute bool, ) *PlanningCtx { planCtx := dsp.newLocalPlanningCtx(ctx, evalCtx)
How about if !distribute { return
?
pkg/sql/distsql_running_test.go, line 158 at r1 (raw file):
evalCtx := p.ExtendedEvalContext() // We need distribute = true so that we executing the plan involves marshaling
nit: so that we executing the plan
pkg/sql/opt_exec_factory.go, line 2098 at r2 (raw file):
// identified by their ordinal position in the table schema. func makeScanColumnsConfig(table cat.Table, cols exec.TableColumnOrdinalSet) scanColumnsConfig { // Set visibility=publicAndNotPublicColumns, since all columns in the "cols"
nit: update comment further?
pkg/sql/scan.go, line 362 at r2 (raw file):
// Register the dependency to the planner, if requested. if planDeps != nil {
cc @RaduBerinde
pkg/sql/scan.go, line 362 at r2 (raw file): Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
Yes, this is no longer needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asubiotto)
pkg/sql/apply_join.go, line 264 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
I don't think
newLocalPlanningCtx
sets this field. Maybe it should?
It does set the field.
pkg/sql/conn_executor_exec.go, line 866 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
NewPlanningCtx
callsnewLocalPlanningCtx
. We should be able to remove thisif distribute
check here and everywhere and haveNewPlanningCtx
behave identically to the old behavior
Yeah, I didn't refactor code all the way, done.
pkg/sql/distsql_physical_planner.go, line 3253 at r1 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
How about
if !distribute { return
?
Done.
pkg/sql/opt_exec_factory.go, line 2098 at r2 (raw file):
Previously, asubiotto (Alfonso Subiotto Marqués) wrote…
nit: update comment further?
Done.
pkg/sql/scan.go, line 362 at r2 (raw file):
Previously, RaduBerinde wrote…
Yes, this is no longer needed.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 23 of 23 files at r4, 17 of 17 files at r5, 7 of 7 files at r6.
Reviewable status: complete! 1 of 0 LGTMs obtained
Release note: None
This commit removes `sql.scanVisibility` in favor of protobuf-generated `execinfrapb.ScanVisibility`. It also introduces prettier aliases for the two values into `execinfra` package that are now used throughout the code. Release note: None
This commit does the following cleanups of `scanNode`: 1. refactors `scanNode.initCols` method to be standalone (it will probably be reused later by distsql spec exec factory). 2. removes `numBackfillColumns`, `specifiedIndexReverse`, and `isSecondaryIndex` fields since they are no longer used. 3. refactors the code to remove `valNeededForCols` field which was always consecutive numbers in range `[0, len(n.cols)-1]`. 4. refactors `getIndexIdx` method to not depend on `scanNode`. Additionally, this commit removes `planDependencies` business from `planTop` since optimizer now handles CREATE VIEW and handles the plan dependencies on its own (and CREATE VIEW was the single user of that struct in the plan top). Also, it removes (which seems like) unnecessary call to `planColumns` when creating distinct spec and an unused parameter from `createTableReaders` method. Release note: None
TFTR! bors r+ |
Build succeeded |
sql: unify PlanningCtx constructors into one
Release note: None
sql: remove separate scanVisilibity struct
This commit removes
sql.scanVisibility
in favor of protobuf-generatedexecinfrapb.ScanVisibility
. It also introduces prettier aliases forthe two values into
execinfra
package that are now used throughout thecode.
Release note: None
sql: clean up of scan node and a few other things
This commit does the following cleanups of
scanNode
:scanNode.initCols
method to be standalone (it willprobably be reused later by distsql spec exec factory).
numBackfillColumns
,specifiedIndexReverse
, andisSecondaryIndex
fields since they are no longer used.valNeededForCols
field which wasalways consecutive numbers in range
[0, len(n.cols)-1]
.getIndexIdx
method to not depend onscanNode
.Additionally, this commit removes
planDependencies
businessfrom
planTop
since optimizer now handles CREATE VIEW and handlesthe plan dependencies on its own (and CREATE VIEW was the single
user of that struct in the plan top).
Also, it removes (which seems like) unnecessary call to
planColumns
when creating distinct spec and an unused parameter from
createTableReaders
method.Addresses: #47474.
Release note: None