Skip to content

Conversation

@harshavamsi
Copy link
Contributor

@harshavamsi harshavamsi commented Sep 30, 2025

Description

Expands streaming aggregations to cardinality aggregator. This PR ensures that we only use the Ordinals Collector while streaming and resets the value after each new batch.

Related Issues

Resolves #19515

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Contributor

✅ Gradle check result for 990a850: SUCCESS

@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.96%. Comparing base (ac6dfa1) to head (53a7264).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...regations/metrics/StreamCardinalityAggregator.java 72.58% 10 Missing and 7 partials ⚠️
...egations/metrics/CardinalityAggregatorFactory.java 50.00% 2 Missing ⚠️
.../search/aggregations/BucketCollectorProcessor.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19484      +/-   ##
============================================
- Coverage     73.09%   72.96%   -0.13%     
+ Complexity    70553    70508      -45     
============================================
  Files          5716     5717       +1     
  Lines        322926   322995      +69     
  Branches      46770    46780      +10     
============================================
- Hits         236032   235676     -356     
- Misses        67882    68368     +486     
+ Partials      19012    18951      -61     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

❕ Gradle check result for c1979ea: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

❌ Gradle check result for bfe824e: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

❕ Gradle check result for 4b6dd24: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@rishabhmaurya
Copy link
Contributor

@harshavamsi we should add integ test similar to the ones we have for streaming terms aggregation. We should do it for both numeric and cardinality aggs.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2025

❕ Gradle check result for 94ce824: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@harshavamsi harshavamsi closed this Oct 2, 2025
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
@harshavamsi harshavamsi force-pushed the expand_streaming_agg_cardinality branch from 1913943 to 53a7264 Compare October 3, 2025 07:27
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

❌ Gradle check result for 53a7264: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@harshavamsi harshavamsi closed this Oct 3, 2025
@harshavamsi harshavamsi reopened this Oct 3, 2025
@harshavamsi harshavamsi changed the title Expand streaming agg cardinality Expand streaming Aggregations to Cardinality Aggregator Oct 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

✅ Gradle check result for 53a7264: SUCCESS

@rishabhmaurya
Copy link
Contributor

In order to allow cardinality aggregator, we also need to enable it at RestSearchAction level -

static boolean canUseStreamSearch(SearchRequest searchRequest) {

@rishabhmaurya
Copy link
Contributor

rishabhmaurya commented Oct 3, 2025

In order to allow cardinality aggregator, we also need to enable it at RestSearchAction level -

I just checked, it seems like we don't need to explicitly check here. So looks good.

@rishabhmaurya rishabhmaurya merged commit 9923617 into opensearch-project:main Oct 3, 2025
63 of 66 checks passed
@rishabhmaurya rishabhmaurya moved this from Todo to Done in Performance Roadmap Oct 3, 2025
@rishabhmaurya rishabhmaurya added the backport 3.3 Backport to 3.3 branch label Oct 3, 2025
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 3, 2025
* Add streaming cardinality aggregator

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add reset

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add reset

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add more tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* add more tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* add integ tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

---------

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
(cherry picked from commit 9923617)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@rishabhmaurya
Copy link
Contributor

created a follow up #19518 to handle other underlying issues

rishabhmaurya pushed a commit that referenced this pull request Oct 4, 2025
)

* Add streaming cardinality aggregator



* Add reset



* Add reset



* Add more tests



* add more tests



* add integ tests



---------


(cherry picked from commit 9923617)

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

public void testBasicCardinality() throws Exception {
try (Directory directory = newDirectory()) {
try (IndexWriter indexWriter = new IndexWriter(directory, new IndexWriterConfig())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Caveat! These tests should be improved with RandomIndexWriter to verify the work on segmented index.

peteralfonsi pushed a commit to peteralfonsi/OpenSearch that referenced this pull request Oct 15, 2025
…roject#19484)

* Add streaming cardinality aggregator

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add reset

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add reset

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* Add more tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* add more tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

* add integ tests

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>

---------

Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 3.3 Backport to 3.3 branch v3.3.0

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Extending Streaming Aggregators to cardinality aggregator

3 participants