-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Conversation
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.
Pinging @elastic/es-core-infra |
private final List<DateMathParser> dateMathParsers; | ||
|
||
MergedDateFormatter(String pattern, List<DateFormatter> formatters) { | ||
assert formatters.size() > 0; |
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.
the array was switched to a list while copying, I assume that was intentional?
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.
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)); |
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.
👍
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.
LGTM - happy when CI is happy
@elasticmachine test this please |
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.
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
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
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
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
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
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.