Skip to content
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

[planner bugfix] add expressions to HAVING #12668

Merged
merged 3 commits into from
Mar 22, 2023

Conversation

systay
Copy link
Collaborator

@systay systay commented Mar 20, 2023

Description

When planning derived tables, we were pushing down predicates into the WHERE clause instead of the HAVING clause, even when the predicate contains aggregation.

Related Issue(s)

Fixes #12550

Checklist

  • "Backport to:" labels have been added if this change should be back-ported
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on the CI
  • Documentation was added or is not required

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the

Signed-off-by: Andres Taylor <[email protected]>
@systay systay merged commit 1d50c94 into vitessio:main Mar 22, 2023
@systay systay deleted the fix-derived-predicate-pushing branch March 22, 2023 08:41
frouioui pushed a commit to planetscale/vitess that referenced this pull request Mar 22, 2023
* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the

Signed-off-by: Andres Taylor <[email protected]>

* update test expecteations

Signed-off-by: Andres Taylor <[email protected]>

---------

Signed-off-by: Andres Taylor <[email protected]>
frouioui pushed a commit to planetscale/vitess that referenced this pull request Mar 22, 2023
* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the

Signed-off-by: Andres Taylor <[email protected]>

* update test expecteations

Signed-off-by: Andres Taylor <[email protected]>

---------

Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
frouioui pushed a commit to planetscale/vitess that referenced this pull request Mar 22, 2023
* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the

Signed-off-by: Andres Taylor <[email protected]>

* update test expecteations

Signed-off-by: Andres Taylor <[email protected]>

---------

Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
frouioui added a commit that referenced this pull request Mar 23, 2023
* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the



* update test expecteations



---------

Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Co-authored-by: Andres Taylor <[email protected]>
frouioui added a commit that referenced this pull request Mar 23, 2023
* [planner bugfix] add expressions to HAVING (#12668)

* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the

Signed-off-by: Andres Taylor <[email protected]>

* update test expecteations

Signed-off-by: Andres Taylor <[email protected]>

---------

Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>

* Fix plan tests

Signed-off-by: Florent Poinsard <[email protected]>

---------

Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Co-authored-by: Andres Taylor <[email protected]>
frouioui added a commit that referenced this pull request Mar 23, 2023
* [planner bugfix] add expressions to HAVING

When a predicate contains aggregation, it should not
be added to the WHERE clause. It should go to the



* update test expecteations



---------

Signed-off-by: Andres Taylor <[email protected]>
Co-authored-by: Andres Taylor <[email protected]>
@hmaurer hmaurer mentioned this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug Report: aggregate column rewritten incorrectly to use WHERE instead of HAVING
3 participants