Skip to content

Commit

Permalink
colbuilder: use correct processorID for wrapped filterers
Browse files Browse the repository at this point in the history
We forgot to use the correct processorID when planning wrapped filterers
which resulted in stats from those processors to be always attributed to
a processor with ID = 0.

Release note: None (no stable release with this bug)
  • Loading branch information
yuzefovich committed Mar 22, 2021
1 parent 6b732e2 commit 25f061e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pkg/sql/colexec/colbuilder/execplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,9 @@ func NewColOperator(
result.ColumnTypes = make([]*types.T, len(spec.Input[0].ColumnTypes))
copy(result.ColumnTypes, spec.Input[0].ColumnTypes)
result.Op = inputs[0]
if err := result.planAndMaybeWrapFilter(ctx, flowCtx, evalCtx, args, core.Filterer.Filter, factory); err != nil {
if err := result.planAndMaybeWrapFilter(
ctx, flowCtx, evalCtx, args, spec.ProcessorID, core.Filterer.Filter, factory,
); err != nil {
return r, err
}

Expand Down Expand Up @@ -1061,7 +1063,7 @@ func NewColOperator(

if !core.HashJoiner.OnExpr.Empty() && core.HashJoiner.Type == descpb.InnerJoin {
if err = result.planAndMaybeWrapFilter(
ctx, flowCtx, evalCtx, args, core.HashJoiner.OnExpr, factory,
ctx, flowCtx, evalCtx, args, spec.ProcessorID, core.HashJoiner.OnExpr, factory,
); err != nil {
return r, err
}
Expand Down Expand Up @@ -1115,7 +1117,7 @@ func NewColOperator(

if onExpr != nil {
if err = result.planAndMaybeWrapFilter(
ctx, flowCtx, evalCtx, args, *onExpr, factory,
ctx, flowCtx, evalCtx, args, spec.ProcessorID, *onExpr, factory,
); err != nil {
return r, err
}
Expand Down Expand Up @@ -1355,6 +1357,7 @@ func (r opResult) planAndMaybeWrapFilter(
flowCtx *execinfra.FlowCtx,
evalCtx *tree.EvalContext,
args *colexecargs.NewColOperatorArgs,
processorID int32,
filter execinfrapb.Expression,
factory coldata.ColumnFactory,
) error {
Expand All @@ -1378,6 +1381,7 @@ func (r opResult) planAndMaybeWrapFilter(
Filter: filter,
},
},
ProcessorID: processorID,
ResultTypes: args.Spec.ResultTypes,
}
return r.createAndWrapRowSource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ network usage: <hidden>
table: geo_table@geom_index
spans: 31 spans
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVeFO20gQ_n9PMZo_gM6n7NomF_Z0Ug4w17SFICdqheoIGXsKFo7X3d1URiiP1Rfok1Vrh5QQxRBVrZofG8238012vm92c4_6U44CR8Hb4GgMt3ASDk_hmuSlia9ygvevgjAAbS6zwpDSlBi9uzMKB8f_ut0D3vvnfDg4G-_6jDHmQf3FvL0dIf4PhqfBOLxwbK3pHgzD4yCEwwu4RQcLmdJZPCWN4gNynDhYKpmQ1lJZ6L5OGKQVCuZgVpQzY-GJg4lUhOIeTWZyQoFje8aQ4pRUh6GDKZk4y-uyyxb69gCXWZFShQ6OyrjQAjoRHkZR9TGNooqzKKrYcwv-tS2HRwhxkYLHQJobUhoXzYCZlTlpAe4S0SbOczDZlASwr19s6pt3a3EiC0OFyWSxnlqXBEVxKsBvsKs7s4Q8Fw7RwavYJDekQc5MOTMCrGgL6gPk42TuYBMtZNcmviYUfO683JpB8ZmUofQkyw0pUh2-6s_DflCVCmQBfS5AW3OsFsqIWmzv7_0oYi6LIsaeWxCoSLelWY_WTBpaGfp8zS6_zS6qKJmtWzONK5jSVKo7iPNcJrGhVACrzbB7OlHWEkgzfbue8QK73I12udvY9VpmxeIiuZsuUqmyaazuvivk9N1fNtPu-kzzbi3SBuV_SDtvG-2WI-6tKtfg4unryTjj9p10mdvtHrDHn6Puf7zn8ybosR7v-X7g8x3x-EHtu3srQ_oz-ve36X8klSHV8Ve77_M_f8trsb9NayHpUhaaVlrbVJnNJw5Sek3Nn5iWM5XQuZJJ_TNNOKx5NZCSNs0ub4JB0WzZAz4m81ay2052W8leO9lrJfvtZL-VvP-EPJn_8S0AAP__tjbCIA==
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMldFO20oQhu_PU4zmBtDxUXZtkxO2qpQCpk1bCHKiVqiOkLGnYOHsurubygjlsfoCfbLKdqCEKIYIVWouHM0__jc738xubtF8y1HgKPgYHIzhGo7C4TFckjq38UVO8PldEAZg7HkmLWlDiTXbW6NwcPja7e7x3qvT4eBkvO0zxpgH9RfzdraEeBsMj4NxeOZUa013YBgeBiHsn8E1OihVSifxlAyKL8hx4mChVULGKF1Jt_ULg7REwRzMZDGzlTxxMFGaUNyizWxOKHBc7TGkOCXdYehgSjbO8nrZ-xL61QbOM5lSiQ6OilgaAZ0I96Oo_JpGUclZFJXsqQf-t6mHRwixTMFjoOwVaYMOfvgENpuSAPbzxyJOlLQkbabkSsrOipwMaIpTAX6jXdzYe8lzYR8dvIhtckUG1MwWMyugIrGw3kk-TuYONtGCpbHxJaHgc-f5vAfyO2lL6VGWW9KkO3wZ-l0-KAsNSkKfCzAVcTA21lbUBL3_d6OIuSyKGHvqgUAy3dRWgV8hP6ww9Kv91gUu2DZYG8XYOM-Xe0AlJbPV1kzjEqY0VfoG4jxXSWwpFcDqZlQ5k-iqJZBm5nr1jWe0y13bLneTdr1XmVycDnfd6Sh0No31zW9CTt9dgeS2QXrBTLurM827NaQ15F_EztuE3f2Ie8vkGl08vhIZZ7y6_Fzmdrt77OHnoPuG93zeBD3W4z3fD3y-JR7ekn13p2VIW_n_CVT-JqhGSlvSHX8ZVJ__-1eeoN1NSgvJFEoaWipt3cpsPnGQ0ktq_sSMmumETrVK6p9pwmHtq4WUjG2yvAkGsklVG3xo5q1mt93stpq9drPXavbbzX6refeReTL_51cAAAD__89JwiA=

statement ok
DROP TABLE geo_table
Expand Down Expand Up @@ -144,7 +144,7 @@ network usage: <hidden>
table: geo_table@geom_index
spans: 31 spans
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVe1O40YU_d-nuLp_ANVVZmyThqkqpYBpUwpBTkSF6ggZ-xYsnBnvzGQVhPJY-wL7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JiHhaxm1skTDzOlCcUt2sKWhALHbo8xpTnpDkMPc7JpUdbL3pfQdxs4L2ROc_RwVKXSCOgkuJ8k8495ksxZ4Ab2gwH_2dTDE4RU5hAwUPaKtEEP37wDW0xJAPv6ZRlnSlqStlByLWVnVUkGNKW5AL_RLm7svcS7sI8eXqQ2uyIDamarmRXgSCytd5KPk4WHTbRkaWx6SSj4wvt53gP5mbSl_KgoLWnSHb4K_S4fzSsNSkKfCzCOOBibaitqgsG_u0nCHEHmQLUOCCTzTW0O_Br5ocPQd_utC1yybbA2irFpWa72gOaUzdZbM03nMKWp0jeQlqXKUku5AFY3w-VMpl1LIC_M9fqMZ7XL36Rdr1Uhl7fDf-p2VLqYpvrmOyGv728G6bec6SfIP4tdsAm7-yMerJJrdPH4SWSccff4-czvdvfYw89B9wXvhbwJeqzHe2EYhXxLPHwl-_7OLz6kz0IVboJqpLQl3QlXQfX533_kDdrdpLSYTKWkoZXSnlqZLSYeUn5JzZ-YUTOd0alWWf0zTTisfbWQk7FNljfBQDYpt8GHZt5q9tvNfqs5aDcHreaw3Ry2mncfmSeLv74FAAD__-BewiI=

# Also works when creating an index.
statement ok
Expand Down Expand Up @@ -196,4 +196,4 @@ network usage: <hidden>
table: geo_table@geom_index
spans: 31 spans
·
Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVe1O40YU_d-nuLp_ANVVZmyThqkqpYBpUwpBTkSF6ggZ-xYsnBnvzGQVhPJY-wL7ZKuxQ5YQ4d0IrUR-THQ_zs2cc2Ymj2g-lChwFP0THY3hHk7i4Rnckrq26U1J8O9fURyBsdeFtKQNZdbs7oziwfHvfveA9367GA7Ox7shY4wFUH-xYG9HiD-j4Vk0jq88N2u6B8P4OIrh8Aru0UOpcjpPp2RQ_IccJx5WWmVkjNIu9Vg3DPI5CuZhIauZdemJh5nShOIRbWFLQoFjt8eY0px0h6GHOdm0KOuxKwp9t4HrQuY0Rw9HVSqNgE6Ch0ky_z9PkjkL3MK-seAv22J4gpDKH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d_utC1yybbA2irFpWa72gOaUzdZbM03nMKWp0jeQlqXKUku5AFY3w-VMpl1LIC_M9fqMZ7XL36Rdr1Uhl7fDf-p2VLqYpvrmOyGv728G6bec6SfIP4tdsAm7-yMerJJrdPH4SWSccff4-czvdvfYw89B9wXvhbwJeqzHe2EYhXxLPHwl-_7OLz6kz0IVboJqpLQl3QlXQfX533_kDdrdpLSYTKWkoZXSnlqZLSYeUn5JzZ-YUTOd0alWWf0zTTisfbWQk7FNljfBQDYpt8GHZt5q9tvNfqs5aDcHreaw3Ry2mncfmSeLv74FAAD__-BewiI=

0 comments on commit 25f061e

Please sign in to comment.