-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Core: Rework epoch time parsing for java time #36914
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
Conversation
This commit converts the epoch time parsing implementation which uses the java time api to create DateTimeFormatters instead of DateFormatter implementations. This will allow multi formats for java time to be implemented in a single DateTimeFormatter in a future change.
|
Pinging @elastic/es-core-infra |
spinscale
left a comment
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 in general, I am not sure about the test case failure yet.
I could not reproduce the test failure in my IDE using just java11, but only via gradle / maybe there is some bwc issue with older java versions...
|
I tracked the failure down to a bug in java 8 (the test passes in java 11). According to the javadocs of DateTimeFormatterBuilder, optional sections should only be output when formatting if they are supported. When using our custom TemporalField in java 8, the isSupportedBy never gets called on our nanos field, it is simply retrieved and always output. I can think about how to workaround this, but I believe it will be difficult and require a change higher up to detect this and choose a different formatter to use. Given that this is fixed in java 11, I am inclined to say this is simply a known issue and amend the test to handle it. @spinscale thoughts? |
|
@rjernst I tend to agree. The only thing this could be uncovered by the end user are names of aggs and scripts (where I am assuming that this formatting is rare). |
|
I created a super small benchmark, which basically uses the date formatter results in the java-time branch (which does not differ too much from master right now in that regard) results with this PR |
|
@elasticmachine run gradle build tests 1 |
This commit converts the epoch time parsing implementation which uses the java time api to create DateTimeFormatters instead of DateFormatter implementations. This will allow multi formats for java time to be implemented in a single DateTimeFormatter in a future change.
This commit converts the epoch time parsing implementation which uses
the java time api to create DateTimeFormatters instead of DateFormatter
implementations. This will allow multi formats for java time to be
implemented in a single DateTimeFormatter in a future change.