-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
SQL: Make sure now() always uses milliseconds precision #36877
Conversation
different system clock implementations or different Java versions (for Java 8, milliseconds precision is used; for Java 9+ a system specific clock implementation is used which can have greater precision than what we need here).
Pinging @elastic/es-search |
Nice find. As this issue is fairly obscure and we might bump into it again, it might make sense to move the clock or now function into the |
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
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. Nice!
@elasticmachine run default distro tests |
* This change is to account for different system clock implementations or different Java versions (for Java 8, milliseconds precision is used; for Java 9+ a system specific clock implementation is used which can have greater precision than what we need here). (cherry picked from commit 1236461)
This is fix for a CI failure reproducible for Java 9+ versions.
What is specific to these versions (as opposed to Java 8) is that the Clock implementation uses system's best clock implementation, whereas in Java 8
System.currentTimeMillis()
is always used. To account for these differences, this solution defines a new Clock which will offer a value fornow()
set to always have milliseconds precision.Fixes #35683.