-
Notifications
You must be signed in to change notification settings - Fork 987
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
Support cumulative aggregations #5209
Conversation
a2a0243
to
ccb992e
Compare
cde7c82
to
396e4d6
Compare
Ok(IdType::Bytes) => "max(id::text)::bytea", | ||
Ok(IdType::String) | Ok(IdType::Int8) => "max(id)", |
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.
Isn't Int8
the only type one allowed for the ID field in a time series?
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.
Yes, I think that's a leftover from before I made Int8
mandatory as the id
Sum => write!(w, "sum(\"{}\")", self.src_column.unwrap().name)?, | ||
Max => write!(w, "max(\"{}\")", self.src_column.unwrap().name)?, | ||
Min => write!(w, "min(\"{}\")", self.src_column.unwrap().name)?, | ||
Sum => write!(w, "sum(\"{}\")", src.unwrap())?, |
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.
would it be cleaner to take a &SqlName
instead of Option
and call unwrap from the caller?
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.
Ignore this was resolved in a later commit than when reviewed
396e4d6
to
fc97ac2
Compare
fc97ac2
to
190171f
Compare
No actual change in functionality
Instead of having an Option for the argument to accomodate `count` which has no argument, use `id` as a dummy argument for that case.
For immutable entities, creating a BRIN index on (block$, vid) is not very helpful. A normal BTree on just block$ works much better.
190171f
to
01be1d1
Compare
This PR allows aggregates that are cumulative from the beginning of time rather than just within a time interval. That is indicated by declaring the aggregate as
@aggregate(fn: "sum", arg:"amount", cumulative: true)
Check the docs in ./docs/aggregation.md for more details.
Note that this PR is on top of PR #5208