Skip to content

Conversation

@ashwanthgoli
Copy link
Contributor

@ashwanthgoli ashwanthgoli commented Jun 6, 2025

What this PR does / why we need it:

First version of range aggregation operator that only support count function for instant queries. It is implemented using a hash aggregation

I have left multiple TODOs but most of them are not immediate concerns. Being able to return partial aggregate results on each Read call is something I'll look into in a follow-up PR.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@ashwanthgoli ashwanthgoli changed the title feat(engine): implement range aggregation operator chore(engine): implement range aggregation operator Jun 6, 2025
@ashwanthgoli ashwanthgoli marked this pull request as ready for review June 10, 2025 05:02
@ashwanthgoli ashwanthgoli requested a review from a team as a code owner June 10, 2025 05:02
Comment on lines +135 to +138
isTSInRange = func(t time.Time) bool {
// Aggregate entries that belong in [earliestTs, evalTs)
return t.Compare(earliestTs) >= 0 && t.Compare(evalTs) < 0
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You could create a helper struct like bloomshipper.Interval that has a Compare(t time.Time) method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 we can add something like this when we add support for range queries

}
tsCol := vec.ToArray().(*array.Timestamp)

for row := range int(record.NumRows()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the records where sorted by timestamp we could use binary search to determine start/end index 😑

@ashwanthgoli ashwanthgoli merged commit 1effa30 into main Jun 13, 2025
65 checks passed
@ashwanthgoli ashwanthgoli deleted the range-agg-operator branch June 13, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants