Skip to content
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

Core: Rework multi date formatter merging #36447

Merged
merged 20 commits into from
Dec 12, 2018
Merged

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Dec 10, 2018

This commit moves the MergedDateFormatter to a package private class and
reworks joda DateFormatter instances to use that instead of a single
DateTimeFormatter with multiple parsers. This will allow the java and
joda multi formats to share the same format parsing method in a
followup.

This commit moves the MergedDateFormatter to a package private class and
reworks joda DateFormatter instances to use that instead of a single
DateTimeFormatter with multiple parsers. This will allow the java and
joda multi formats to share the same format parsing method in a
followup.
@rjernst rjernst added :Core/Infra/Core Core issues without another label v7.0.0 >refactoring v6.6.0 labels Dec 10, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@rjernst rjernst requested a review from spinscale December 10, 2018 17:36
private final List<DateMathParser> dateMathParsers;

MergedDateFormatter(String pattern, List<DateFormatter> formatters) {
assert formatters.size() > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

the array was switched to a list while copying, I assume that was intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that was intentional

@@ -86,7 +87,7 @@ default DateTime parseJoda(String input) {
* Return the given millis-since-epoch formatted with this format.
*/
default String formatMillis(long millis) {
return format(Instant.ofEpochMilli(millis));
return format(ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneOffset.UTC));
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@spinscale spinscale left a comment

Choose a reason for hiding this comment

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

LGTM - happy when CI is happy

@rjernst
Copy link
Member Author

rjernst commented Dec 11, 2018

@elasticmachine test this please

@rjernst rjernst merged commit c4f4378 into elastic:master Dec 12, 2018
@rjernst rjernst deleted the timeapi18 branch December 12, 2018 07:47
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Dec 12, 2018
This commit moves the MergedDateFormatter to a package private class and
reworks joda DateFormatter instances to use that instead of a single
DateTimeFormatter with multiple parsers. This will allow the java and
joda multi formats to share the same format parsing method in a
followup.
rjernst added a commit that referenced this pull request Dec 13, 2018
This commit moves the MergedDateFormatter to a package private class and
reworks joda DateFormatter instances to use that instead of a single
DateTimeFormatter with multiple parsers. This will allow the java and
joda multi formats to share the same format parsing method in a
followup.
spinscale added a commit to spinscale/elasticsearch that referenced this pull request Dec 13, 2018
Due to the change in exception handling in elastic#36447 the backport now used
different exceptions on parser failures between java and joda time
formatting. This uses now IllegalArgumentExceptions for formatting
errors all over the place.

Closes elastic#36598
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Dec 19, 2018
This commit partially reverts elastic#36447 by using the ability of Joda time's
DateTimeFormatterBuilder to append multiple parsers instead of using the
MergedDateFormatter. The MergedDateFormatter will be removed in a future
change, as it is not as performant due to creating potentially many
exceptions during heavy date parsing. This change is a stop-gap until
that followup is ready.

closes elastic#36602
rjernst added a commit that referenced this pull request Dec 19, 2018
This commit partially reverts #36447 by using the ability of Joda time's
DateTimeFormatterBuilder to append multiple parsers instead of using the
MergedDateFormatter. The MergedDateFormatter will be removed in a future
change, as it is not as performant due to creating potentially many
exceptions during heavy date parsing. This change is a stop-gap until
that followup is ready.

closes #36602
rjernst added a commit that referenced this pull request Dec 19, 2018
This commit partially reverts #36447 by using the ability of Joda time's
DateTimeFormatterBuilder to append multiple parsers instead of using the
MergedDateFormatter. The MergedDateFormatter will be removed in a future
change, as it is not as performant due to creating potentially many
exceptions during heavy date parsing. This change is a stop-gap until
that followup is ready.

closes #36602
rjernst added a commit that referenced this pull request Dec 19, 2018
This commit partially reverts #36447 by using the ability of Joda time's
DateTimeFormatterBuilder to append multiple parsers instead of using the
MergedDateFormatter. The MergedDateFormatter will be removed in a future
change, as it is not as performant due to creating potentially many
exceptions during heavy date parsing. This change is a stop-gap until
that followup is ready.

closes #36602
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants