[6.8] Week based parsing for ingest date processor (#58597)#58805
Merged
pgomulka merged 9 commits intoelastic:6.8from Jul 2, 2020
Merged
[6.8] Week based parsing for ingest date processor (#58597)#58805pgomulka merged 9 commits intoelastic:6.8from
pgomulka merged 9 commits intoelastic:6.8from
Conversation
Date processor was incorrectly parsing week based dates because when a weekbased year was provided ingest module was thinking year was not on a date and was trying to applying the logic for dd/MM type of dates. Date Processor is also allowing users to specify locale parameter. It should be taken into account when parsing dates - currently only used for formatting. If someone specifies 'en-us' locale, then calendar data rules for that locale should be used. The exception is iso8601 format. If someone is using that format, then locale should not override calendar data rules. closes elastic#58479 # Conflicts: # modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateFormat.java # modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/30_date_processor.yml # server/src/main/java/org/elasticsearch/common/time/DateFormatters.java # server/src/main/java/org/elasticsearch/common/time/IsoCalendarDataProvider.java # server/src/main/java/org/elasticsearch/index/mapper/DateFieldMapper.java # server/src/main/java/org/elasticsearch/script/JodaCompatibleZonedDateTime.java
Collaborator
|
Pinging @elastic/es-core-infra (:Core/Infra/Core) |
rjernst
reviewed
Jul 2, 2020
| * Java based - formats with '8' prefix - week based parsing and calculations are using JDK default calendar data provider which is Sunday,1. | ||
| Sunday is considered first day of a week and it requires only 1 day in a week to for the first week of the year. | ||
| It can be worked around by using locale which is based on ISO8601 rule (Monday,4) - for instance en-GB | ||
| This issue is fixed in Elasticsearch 7.7 https://github.com/elastic/elasticsearch/pull/48209 |
Member
There was a problem hiding this comment.
This description is confusing. Is the bug fixed here or in 7.7.0?
Contributor
Author
There was a problem hiding this comment.
fair point, I will try to rephrase this in another doc PR.
Previously the parsing would fail with exception.
This PR fixes the bug so that parsing does not fail, but is uses Sunday,1 rule. So results are slightly different around when the year or week starts.
The 'ultimate' fixes are in 7.7 when IsoCalendarDataProvider is used and -Djava.locale.providers=SPI,COMPAT is set in jvm options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports the following commits to 6.8: