-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
distsql: refactor distributed aggregation to support arbitrary local aggregate inputs in final stage #18386
distsql: refactor distributed aggregation to support arbitrary local aggregate inputs in final stage #18386
Conversation
0f16dfc
to
7b4a226
Compare
Looks great to me! @knz, is the new Review status: 0 of 5 files reviewed at latest revision, 6 unresolved discussions, all commit checks successful. pkg/sql/distsql_physical_planner.go, line 1400 at r1 (raw file):
pkg/sql/distsqlplan/aggregator_funcs.go, line 93 at r1 (raw file):
[nit] use pkg/sql/distsqlrun/aggregator.go, line 302 at r1 (raw file):
would be nice to avoid the allocation for the common case of one value. Maybe pkg/sql/distsqlrun/aggregator.go, line 303 at r1 (raw file):
[nit] use pkg/sql/parser/aggregate_builtins.go, line 64 at r1 (raw file):
This should document the arguments (maybe name them pkg/sql/parser/aggregate_builtins.go, line 216 at r1 (raw file):
[nit] can just be Comments from Reviewable |
7b4a226
to
610ddc4
Compare
Review status: 0 of 6 files reviewed at latest revision, 6 unresolved discussions. pkg/sql/distsql_physical_planner.go, line 1400 at r1 (raw file): Previously, RaduBerinde wrote…
The loop that uses this is actually nested within this outer loop (loops over all aggregations in the plan). This counter persists across each aggregation, so it's necessary to initialize this before the loop of aggregations. pkg/sql/distsqlplan/aggregator_funcs.go, line 93 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/distsqlrun/aggregator.go, line 302 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/distsqlrun/aggregator.go, line 303 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/parser/aggregate_builtins.go, line 64 at r1 (raw file): Previously, RaduBerinde wrote…
Done. pkg/sql/parser/aggregate_builtins.go, line 216 at r1 (raw file): Previously, RaduBerinde wrote…
Done. Comments from Reviewable |
Review status: 0 of 6 files reviewed at latest revision, 7 unresolved discussions. pkg/sql/distsql_physical_planner.go, line 1400 at r1 (raw file): Previously, richardwu (Richard Wu) wrote…
Ah sorry didn't see the nesting properly. pkg/sql/distsql_physical_planner.go, line 1436 at r1 (raw file):
Instead of subtracting Comments from Reviewable |
610ddc4
to
e43919a
Compare
Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions. pkg/sql/distsql_physical_planner.go, line 1436 at r1 (raw file): Previously, RaduBerinde wrote…
Good point! Done. Comments from Reviewable |
Comments from Reviewable |
LGTM with nit. Does this patch also enable fixing #10495? Reviewed 1 of 5 files at r1, 5 of 5 files at r2. pkg/sql/parser/aggregate_builtins.go, line 222 at r2 (raw file):
nit: Comments from Reviewable |
e43919a
to
b42cb3e
Compare
This should be possible now as long as we can parse and propagate the other arguments. Review status: 4 of 6 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. pkg/sql/parser/aggregate_builtins.go, line 222 at r2 (raw file): Previously, knz (kena) wrote…
Done. Comments from Reviewable |
👍 thanks Reviewed 2 of 2 files at r3. Comments from Reviewable |
85c1a89
to
626027b
Compare
…aggregate inputs in final stage
626027b
to
95cff88
Compare
In order to implement a distributed version of STDDEV and VARIANCE that is numerically stable (see #14351), we require the final stage aggregators to have access to multiple local (or intermediary) aggregate values (in the case of VARIANCE, we require the intermediary aggregate values "SQDIFF", "SUM", and "COUNT"; FYI see https://www.johndcook.com/blog/skewness_kurtosis/ and https://github.com/cockroachdb/cockroach/pull/17728/files).
This PR allows specifying the corresponding local indices in
LocalStage
that theFinalStage
aggregator functions may use as inputs inDistAggregationTable
.There is no logical change to current aggregate functions.
VARIANCE
before merging this refactor.cc: @vivekmenezes