Skip to content

Fix AutoDateHistogram RoundingInfo equals/hashCode to include all serialized fields - #151156

Merged
swallez merged 3 commits into
elastic:mainfrom
junhyeong9812:fix/auto-date-histogram-rounding-info-equals
Jun 19, 2026
Merged

swallez merged 3 commits into
elastic:mainfrom
junhyeong9812:fix/auto-date-histogram-rounding-info-equals

Conversation

@junhyeong9812

Copy link
Copy Markdown
Contributor

AutoDateHistogramAggregationBuilder.RoundingInfo serializes five fields in writeTo (rounding, roughEstimateDurationMillis, innerIntervals, unitAbbreviation, dateTimeUnit) but its equals()/hashCode() only consider three of them, omitting roughEstimateDurationMillis (a long) and unitAbbreviation (a String). Two RoundingInfo instances that differ only in one of those serialized fields therefore compare equal and share a hash code.

This includes both fields in equals() and hashCode() and adds a regression test. RoundingInfo equality also feeds into InternalAutoDateHistogram.BucketInfo, which compares RoundingInfo[] via deep equality, so this also makes reduce/result equality correct.

Closes #151155

RoundingInfo serializes roughEstimateDurationMillis and unitAbbreviation
but equals()/hashCode() omitted them, so instances differing only in those
fields compared equal. Include both and add a regression test. This also
fixes RoundingInfo[] deep equality used in InternalAutoDateHistogram.
@elasticsearchmachine elasticsearchmachine added external-contributor Pull request authored by a developer outside the Elasticsearch team needs:triage Requires assignment of a team area label v9.5.0 labels Jun 13, 2026
@swallez swallez added :Analytics/Aggregations Aggregations >bug and removed needs:triage Requires assignment of a team area label labels Jun 17, 2026
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jun 17, 2026
@swallez swallez self-assigned this Jun 17, 2026

@swallez swallez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix!

@junhyeong9812

Copy link
Copy Markdown
Contributor Author

Thank you very much for taking the time to review and approve this — I really appreciate it!

@swallez

swallez commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@elasticmachine test this

@junhyeong9812

Copy link
Copy Markdown
Contributor Author

Thank you again — I really appreciate it!

@swallez
swallez merged commit 5130e38 into elastic:main Jun 19, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >bug external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto_date_histogram aggregation: RoundingInfo equals()/hashCode() omit serialized fields ("roughEstimateDurationMillis", "unitAbbreviation")

3 participants