Repository navigation
fix: stop aggregate_statistics walk at the first aggregate below a Final - #27307
CuteChuanChuan wants to merge 2 commits into
Conversation
HairstonE
left a comment
There was a problem hiding this comment.
@CuteChuanChuan Thanks for putting this in.
I reviewed the updated conditional and the test cases, ran the tests with and without the change, had claude conduct its own review, and ran the CI test jobs locally on the PR.
This looks good apart from one missing test. There should be a test that covers
SELECT count(1) FILTER (WHERE c > 0) FROM (SELECT count(1) AS c FROM t);On main right now it incorrectly returns 5 instead of 1, with no error. This change fixes that, but the tests should reflect it. Something like this in the new block:
query I
SELECT count(1) FILTER (WHERE c > 0) FROM (SELECT count(1) AS c FROM t);
----
1
@HairstonE Thanks for pointing this out! Good catch! |
|
@jayzhan211 could you PTAL when you have a chance? Thanks 🙏! |
Which issue does this PR close?
count(*) FILTER (WHERE ...)over an aggregate subquery fails with an internal error fromaggregate_statistics#27220.Rationale for this change
As stated in #27220,
count(*) FILTER (WHERE ...)over an aggregate subquery fails to plan with an internal error fromaggregate_statistics.What changes are included in this PR?
As pointed out in the issue,
take_optimizablenow stops at the firstAggregateExecbelow aFinaland uses it only if it is usable (raw input, noGROUP BY, no filter).What is the testing strategy for this PR?
Added tests provided in issue into
aggregate.slt.Are there any user-facing changes?
No.