Skip to content

Conversation

@anandheritage
Copy link

Summary

  • Extends star-tree range aggregation validation to support DateDimension in addition to NumericDimension
  • Previously, range aggregations with star-tree optimization only worked with numeric fields
  • Now date fields can also leverage star-tree indexes for range aggregations

Changes

  • StarTreeQueryContext.java: Updated validateRangeAggregationSupport() to accept DateDimension
  • SearchServiceStarTreeTests.java: Updated test Case 6 to verify date field range aggregations use star-tree
  • CHANGELOG.md: Added entry for this feature

Test plan

  • Updated existing test case in SearchServiceStarTreeTests.java
  • All star-tree tests passing locally (./gradlew :server:test --tests "org.opensearch.search.aggregations.startree.*")

Related Issues

Resolves the TODO in StarTreeQueryContext.java: "Add support for date type ranges"

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Adds support for date type dimensions in range aggregation validation within the Star Tree query context. The validation logic is broadened to accept both numeric and date fields, with corresponding test case updates demonstrating the new capability.

Changes

Cohort / File(s) Summary
Star Tree Range Aggregation Date Support
CHANGELOG.md
Added changelog entry documenting new support for date type dimensions in range aggregation validation.
Star Tree Range Aggregation Date Support
server/src/main/java/org/opensearch/search/startree/StarTreeQueryContext.java
Modified validateRangeAggregationSupport to permit range aggregations on DateDimension fields in addition to NumericDimension fields. Updated condition logic and comment to reflect support for both numeric and date field types.
Star Tree Range Aggregation Date Support
server/src/test/java/org/opensearch/search/SearchServiceStarTreeTests.java
Updated test case 6 in testQueryParsingForRangeAggregations to validate range aggregations on date fields (TIMESTAMP_FIELD as DateDimension). Adjusted expected StarTreeQueryContext to include DateDimension and OrdinalDimension with corresponding metrics.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Search:Aggregations, v3.4.0

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding date dimension support for range aggregation validation in star-tree, which aligns with the core modifications across all three files.
Description check ✅ Passed The description covers the main change, provides details on modified files, includes test verification, and references related issues. However, it lacks a formal 'Related Issues' section with the issue number format specified in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@anandheritage anandheritage force-pushed the feature/star-tree-date-range-support branch 3 times, most recently from cbd689b to 3d2a5c8 Compare January 22, 2026 15:08
@github-actions
Copy link
Contributor

✅ Gradle check result for 3d2a5c8: SUCCESS

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.24%. Comparing base (af61c36) to head (3d2a5c8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ensearch/search/startree/StarTreeQueryContext.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20460      +/-   ##
============================================
- Coverage     73.24%   73.24%   -0.01%     
- Complexity    71961    71968       +7     
============================================
  Files          5795     5798       +3     
  Lines        329185   329333     +148     
  Branches      47403    47421      +18     
============================================
+ Hits         241125   241222      +97     
- Misses        68734    68811      +77     
+ Partials      19326    19300      -26     

☔ 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.

This change extends the star-tree range aggregation validation to support
DateDimension in addition to NumericDimension. Previously, range aggregations
with star-tree optimization only worked with numeric fields. Now date fields
can also leverage star-tree indexes for range aggregations.

Signed-off-by: Anand Kumar Shaw <anandkrshawheritage@gmail.com>
@anandheritage anandheritage force-pushed the feature/star-tree-date-range-support branch from 3d2a5c8 to e6110c3 Compare January 23, 2026 03:52
@github-actions
Copy link
Contributor

❌ Gradle check result for e6110c3: FAILURE

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?

Copy link
Member

@sandeshkr419 sandeshkr419 left a comment

Choose a reason for hiding this comment

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

Thanks @anandheritage for working on this.

Can you also add a test in RangeAggregatorTests to validate the results.

It has been sometime I had worked on the codebase, but I strongly suspect we will need to do some validation on the ranges like I did for in range queries on date field: #17443

This is because how we store date fields as aggregated intervals and not raw date values.

Feel free to extract out common utilities as required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants