Closed Codykilpatrick closed 9 months ago
Marked this as a draft for now, after thinking about it isIntervalLike does need to be separate from isNumberLike since interval types don't support aggregations like VariancePop.
Currently this works for all aggregates except SUM and that is due to the coalesce here: https://github.com/graphile/pg-aggregates/blob/975eefb2c13589fe856d14ba66830e29d0b48d72/src/AggregateSpecsPlugin.ts#L76
When attempting an aggregate sum query on an interval type it generates the following error:
"errors": [
{
"message": "COALESCE types interval and integer cannot be matched",
Is it possible to remove the coalesce and the "isNonNull" property? I did some local testing and no issues with aggregating both null and non-null interval/numeric data types but I might be missing some edge cases.
I think though that would be a breaking change since people who are expecting 0 in that situations would now be getting null but am curious to your thoughts.
@benjie Are their certain tests you would like to see added for this PR?
It'd be nice if we actually had any tests in this repo :grimacing:
I'm working on Worker for the next week or so then I'll be back to thinking about PostGraphile again. Sorry for the delay, but I've neglected Worker for too long.
All good! Thank you for the response!
@benjie Curious if there has been any movement on this one!
Sorry, this is still on my TODO list, but I'm currently focussed on earning some money; I spent altogether too much time on OSS last year and not enough on paying the bills.
All good! bills are definitely the priority here 😆
Released in @graphile/pg-aggregates@0.2.0-beta.5
Description
Expands the AggregateSpecsPlugin to check for Interval types as well as numeric.
Possible breaking change: I removed the isNonNull requirement and the coalesce from Sum. Now people who were properly getting their aggregates coalsced into 0 will now receive null.
Performance impact
Unknown
Security impact
Unknown
Checklist
yarn lint:fix
passes.yarn test
passes.RELEASE_NOTES.md
file (if one exists).This will be my first contribution so please let me know if I missed anything, it seemed relatively simple though!