Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Conversation

@seebs
Copy link
Contributor

@seebs seebs commented Feb 24, 2023

After tracking through a whole bunch of unrelated code and coming up with a 40-line patch that mostly fixed this, I realized that the fact that it worked for count(field) meant something was making it work, added countStarPlanExpression to that case, and magically everything got better.

Writing one line of code: 30 seconds
Figuring out which one line of code to write: two days

@seebs seebs requested a review from paddyjok February 24, 2023 16:23
@seebs seebs force-pushed the fb-1997 branch 4 times, most recently from 2276ed4 to 1e3880d Compare February 27, 2023 23:46
@seebs seebs requested a review from tgruben February 27, 2023 23:46
@seebs
Copy link
Contributor Author

seebs commented Feb 27, 2023

@tgruben, tagged you on review because Pat looked at the original second commit, figured out it was wrong, and fixed it, so now the second commit in particular needs someone else to look at it and verify that this makes sense.

@bruce-b-molecula bruce-b-molecula self-requested a review March 1, 2023 19:00
seebs added 3 commits March 1, 2023 17:56
It turns out that `having count(*) ...` was always treating
the count(*) as exactly 1. After studying this a lot, I noticed
that in fact, we correctly handle other counts. The reason is
that there's already code to recognize aggregates in `having`
clauses as matching aggregates that are being computed -- but
it only covers the other aggregate clause types, not the newly
added `countStarPlanExpression` from making `count(*)` work even
if there's no `_id` field.

We add several corresponding test cases.
Added a test case for this, and also added a fix for it.
Underlying issue: qualifiedRefPlanExpression could end up
producing an int64 instead of a pql.Decimal, even though it
had expected type Decimal.

Originally this worked by politely converting an int64 to
a pql.Decimal in the Evaluate phase, but this was not ideal;
the real question is why it was coming out as an int64 at
that step. Showed this to Pat, who spent a while studying it
and produced a better fix.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jrbrinlee1 jrbrinlee1 self-requested a review March 2, 2023 00:29
Copy link
Contributor

@jrbrinlee1 jrbrinlee1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@paddyjok paddyjok merged commit b35c240 into master Mar 2, 2023
@paddyjok paddyjok deleted the fb-1997 branch March 2, 2023 05:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants