-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Set start of the week to Monday for root locale using SPI #45384
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
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dbc693d
Set start of the week to Monday for root locale (#43652)
pgomulka df6d6c2
change skip reason
pgomulka 295ee95
compile error
pgomulka 2d3b088
not orking spi
pgomulka 9271722
working unit test
pgomulka 3852e92
cleanup
pgomulka 606ad13
change providers for 9+
pgomulka d047999
revert changes IsoLocale
pgomulka 1145509
cleanup
pgomulka ad36175
move spi files to server
pgomulka f25f719
make unit test pass from gradle
pgomulka 3f1edbb
expermienting with gradle tasks
pgomulka 2967aec
uncomment jar hell check
pgomulka a70562f
only add settings in buildplugin
pgomulka 522862a
allign options for locale providers
pgomulka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
47 changes: 47 additions & 0 deletions
47
...src/main/resources/rest-api-spec/test/search.aggregation/310_date_agg_per_day_of_week.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| setup: | ||
| - skip: | ||
| version: " - 7.3.99" | ||
| reason: "only backported to 7.4 (7x)" | ||
|
|
||
| - do: | ||
| indices.create: | ||
| index: test | ||
| body: | ||
| mappings: | ||
| properties: | ||
| date: | ||
| type: date | ||
|
|
||
| - do: | ||
| index: | ||
| index: test | ||
| id: 1 | ||
| body: { "date": "2009-11-15T14:12:12" } | ||
|
|
||
| - do: | ||
| indices.refresh: | ||
| index: [test] | ||
|
|
||
| --- | ||
| # The inserted document has a field date=2009-11-15T14:12:12 which is Sunday. | ||
| # When aggregating per day of the week this should be considered as last day of the week (7) | ||
| # and this value should be used in 'key_as_string' | ||
| "Date aggregartion per day of week": | ||
| - do: | ||
| search: | ||
| rest_total_hits_as_int: true | ||
| index: test | ||
| body: | ||
| aggregations: | ||
| test: | ||
| "date_histogram": { | ||
| "field": "date", | ||
| "calendar_interval": "day", | ||
| "format": "e", | ||
| "offset": 0 | ||
| } | ||
|
|
||
| - match: {hits.total: 1} | ||
| - length: { aggregations.test.buckets: 1 } | ||
| - match: { aggregations.test.buckets.0.key_as_string: "7" } |
41 changes: 41 additions & 0 deletions
41
server/src/main/java/org/elasticsearch/common/time/IsoCalendarDataProvider.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Licensed to Elasticsearch under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.elasticsearch.common.time; | ||
|
|
||
| import java.util.Calendar; | ||
| import java.util.Locale; | ||
| import java.util.spi.CalendarDataProvider; | ||
|
|
||
| public class IsoCalendarDataProvider extends CalendarDataProvider { | ||
|
|
||
| @Override | ||
| public int getFirstDayOfWeek(Locale locale) { | ||
| return Calendar.MONDAY; | ||
| } | ||
|
|
||
| @Override | ||
| public int getMinimalDaysInFirstWeek(Locale locale) { | ||
| return 4; | ||
| } | ||
|
|
||
| @Override | ||
| public Locale[] getAvailableLocales() { | ||
| return new Locale[]{Locale.ROOT}; | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
server/src/main/resources/META-INF/services/java.util.spi.CalendarDataProvider
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| org.elasticsearch.common.time.IsoCalendarDataProvider |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to disable warning checks? Can't we use assertWarnings if necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have a look to enable this again