-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[gen4 planner] Make sure to not push down expressions when not possible #12607
Conversation
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
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.
I don't this is correct. The query we are trying to fix should not be using the AggregateRandom
expression here in the first place
…level Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Null
columnsSigned-off-by: Andres Taylor <andres@planetscale.com>
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.
LGTM
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.
❤️
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…le (vitessio#12607) * Fix random aggregation to not select Null column Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * stop pushing down projections that should be evaluated at the vtgate level Signed-off-by: Andres Taylor <andres@planetscale.com> * undo changes to AggregateRandom Signed-off-by: Andres Taylor <andres@planetscale.com> * clean up code Signed-off-by: Andres Taylor <andres@planetscale.com> * fix executor test mock Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
…le (vitessio#12607) * Fix random aggregation to not select Null column Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * stop pushing down projections that should be evaluated at the vtgate level Signed-off-by: Andres Taylor <andres@planetscale.com> * undo changes to AggregateRandom Signed-off-by: Andres Taylor <andres@planetscale.com> * clean up code Signed-off-by: Andres Taylor <andres@planetscale.com> * fix executor test mock Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
…le (#12607) (#12646) * Fix random aggregation to not select Null column * stop pushing down projections that should be evaluated at the vtgate level * undo changes to AggregateRandom * clean up code * fix executor test mock --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
…le (vitessio#12607) * Fix random aggregation to not select Null column * stop pushing down projections that should be evaluated at the vtgate level * undo changes to AggregateRandom * clean up code * fix executor test mock Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com>
…le (#12607) (#12647) * [gen4 planner] Make sure to not push down expressions when not possible (#12607) * Fix random aggregation to not select Null column * stop pushing down projections that should be evaluated at the vtgate level * undo changes to AggregateRandom * clean up code * fix executor test mock Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> * Fix schema error Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
…le (#12607) (#12648) * Fix random aggregation to not select Null column * stop pushing down projections that should be evaluated at the vtgate level * undo changes to AggregateRandom * clean up code * fix executor test mock --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
Description
This PR fixes #12540 by making sure to not push down to MySQL complex expressions that involved aggregations.
If we have a derived table and it's aggregating results for us, we can't use these results until the are fully aggregated, which happens on the vtgate level.
In the query above, since we have to spread out the aggregation across all
user
shards, we can't push down the division between the two sums until after summing up the individual shard results.Related Issue(s)
Fixes #12540
Checklist
Deployment Notes