Skip to content

Handle long overflow in dates #124048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Mar 26, 2025
Merged

Handle long overflow in dates #124048

merged 21 commits into from
Mar 26, 2025

Conversation

smalyshev
Copy link
Contributor

This makes sure that dates that overflow a long fail with a reasonable message rather than an ArithmeticException. This mostly just hits the field mapper.

Update on #112650

Fixes #112483

@smalyshev smalyshev added :StorageEngine/Mapping The storage related side of mappings :Search Foundations/Mapping Index mappings, including merging and defining field types >bug v9.0.0 v8.19.0 v8.18.1 v9.0.1 and removed v9.0.0 labels Mar 4, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @smalyshev, I've created a changelog YAML for you.

@smalyshev smalyshev requested review from nik9000 and javanna March 4, 2025 21:25
@smalyshev smalyshev marked this pull request as ready for review March 4, 2025 21:32
@smalyshev smalyshev requested a review from a team as a code owner March 4, 2025 21:32
@elasticsearchmachine elasticsearchmachine added Team:StorageEngine Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Mar 4, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@smalyshev smalyshev removed Team:StorageEngine :StorageEngine/Mapping The storage related side of mappings labels Mar 4, 2025
@smalyshev smalyshev requested a review from costin March 4, 2025 21:48
@smalyshev smalyshev added the auto-backport Automatically create backport pull requests when merged label Mar 17, 2025
@javanna
Copy link
Member

javanna commented Mar 21, 2025

This fix seems to be linked as well with #125321 , can you double check?

@smalyshev
Copy link
Contributor Author

smalyshev commented Mar 21, 2025

@javanna Unfortunately I can't reproduce the issue as described in #125321 but if somehow 2024-07-09 21:11:31 gets misparsed as far-future data then yes, it'd be the same bug. Though if it's really the regular date in 2024 there would be another issue with how it ended up being parsed as far-future? So far I was able only to reproduce this with explicitly broken dates.

Copy link
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

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

lgtm from a core/infra perspective 👍

@smalyshev smalyshev enabled auto-merge (squash) March 26, 2025 15:03
@smalyshev smalyshev merged commit 07921a7 into elastic:main Mar 26, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 124048

smalyshev added a commit to smalyshev/elasticsearch that referenced this pull request Mar 26, 2025
* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/500_date_range.yml
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java
smalyshev added a commit to smalyshev/elasticsearch that referenced this pull request Mar 26, 2025
* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java
@smalyshev
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x
9.0
8.18

Questions ?

Please refer to the Backport tool documentation

@smalyshev smalyshev deleted the fix-date-112483 branch March 26, 2025 17:06
smalyshev added a commit to smalyshev/elasticsearch that referenced this pull request Mar 26, 2025
* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/500_date_range.yml
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
* Handle long overflow in dates (#124048)

* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* Add import
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
* Handle long overflow in dates (#124048)

* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/500_date_range.yml
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* Add import
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
* Handle long overflow in dates (#124048)

* Handle long overflow in dates

(cherry picked from commit 07921a7)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/500_date_range.yml
#	server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* Add import
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
* Handle long overflow in dates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v8.18.1 v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

date math overflow incorrectly returns 500
7 participants