Skip to content

Conversation

@pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Jul 1, 2020

Backports the following commits to 6.8:

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
@pgomulka pgomulka added the :Core/Infra/Core Core issues without another label label Jul 1, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Core)

@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jul 1, 2020
@pgomulka pgomulka merged commit fd5a708 into elastic:6.8 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
Copy link
Member

Choose a reason for hiding this comment

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

This description is confusing. Is the bug fixed here or in 7.7.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

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

Labels

:Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants