Skip to content

feat(aggregation): Add HistogramAggregation#58

Merged
MatusBoa merged 2 commits into
mainfrom
feat-date-histogram-aggregation
Apr 16, 2026
Merged

feat(aggregation): Add HistogramAggregation#58
MatusBoa merged 2 commits into
mainfrom
feat-date-histogram-aggregation

Conversation

@MatusBoa
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

A new DateHistogramAggregation class is introduced alongside supporting exception handling, comprehensive unit and integration tests, and documentation updates to enable date-based histogram aggregations with configurable calendar/fixed intervals and optional filtering and global wrapping capabilities.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md, README.md, src/Aggregation/AGENTS.md
Added DateHistogramAggregation to aggregation taxonomy, exception hierarchy, and documentation tables; README includes merge conflict marker and usage examples with calendarInterval, fixedInterval, and configuration options.
Implementation
src/Aggregation/DateHistogramAggregation.php
New class implementing AggregationInterface with FilterableAggregation and GlobalizableAggregation traits; validates interval configuration, constructs Elasticsearch date_histogram payload, applies filter/global wrappers via composition.
Exception Handling
src/Exception/Aggregation/InvalidDateHistogramIntervalException.php
New exception class extending AggregationException for invalid date histogram interval scenarios (missing or duplicate intervals).
Testing
tests/Unit/Aggregation/DateHistogramAggregationTest.php, tests/Integration/Aggregation/DateHistogramAggregationTest.php
Comprehensive unit tests verifying JSON serialization, interval validation, and trait composition; integration tests validating Elasticsearch responses for calendar interval, fixed interval, and formatted/minDocCount scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title states 'Add HistogramAggregation' but the changeset implements 'DateHistogramAggregation' with date-based histogram functionality, not generic histogram aggregation. Update the title to 'feat(aggregation): Add DateHistogramAggregation' to accurately reflect the specific aggregation type being implemented.
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.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether a description exists that relates to the changeset. Add a pull request description explaining the purpose of the DateHistogramAggregation feature, its use cases, and any relevant implementation details.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-date-histogram-aggregation

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.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 16, 2026

Coverage Report for CI Build 24508901336

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 22 of 22 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 481
Covered Lines: 481
Line Coverage: 100.0%
Coverage Strength: 11.19 hits per line

💛 - Coveralls

Implement date_histogram bucket aggregation with mutually exclusive
calendar_interval and fixed_interval params, plus optional format, time_zone,
offset, and min_doc_count. Validates exactly one interval type is provided.
Includes InvalidDateHistogramIntervalException and 9 unit tests.
Add integration tests verifying calendar interval, fixed interval, and
format+minDocCount against real Elasticsearch. Add DateHistogramAggregation
section to README with usage examples for all constructor options.
@MatusBoa MatusBoa force-pushed the feat-date-histogram-aggregation branch from 77ab0c1 to 57093f0 Compare April 16, 2026 11:57
@MatusBoa MatusBoa merged commit f1a0739 into main Apr 16, 2026
9 of 10 checks passed
@MatusBoa MatusBoa deleted the feat-date-histogram-aggregation branch April 16, 2026 12:02
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