-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Negative seconds of epoch are not mapped correctly to dates for values <=-1000, and big negative values throw an unexpected exception. #72123
Comments
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Negative epoch times were deprecated in 6.7 (#36793) and removed in 7.0. If you are curious why, I recommend reading #40983 which had a long discussion as to the underlying reasons. So this is working as intended. The number you are passing in is considered part of the year of the date, since no other parts exist. Please convert your date from epoch time to another date format for years prior to 1970. |
@rjernst I read your final comments on the issue regarding java instants. As per the explanation, the argument makes sense for milliseconds but not for seconds. And the other argument, "we also think negative epoch values in general are uncommon" , it seems people before me have raised concerns about this as well. Either way, considering the detailed discussion on the thread I imagine that further discussion on this is unnecessary. If anything, the precision issue could have been handled better by letting the user make the decision on it instead of deprecating the possibility altogether. The document needs to be updated for the On the other hand, could you give me an idea on the repercussions of using negative integer values in epoch seconds with Additionally, in a future release will you reject all negative epoch values with a proper exception versus the current situation where it works for some cases? |
Apologies @alk-gmathews , I was incorrect in my assertion before. We did deprecate and remove negative value support for Looking back, the problem you had is a common one. Since the |
@rjernst thanks for the update. This is actually really good news since we can proceed with updating our mappings, which is a medium-sized endeavor but still simpler to execute, instead of the other options we were considering. |
Elasticsearch version (
bin/elasticsearch --version
):Version: 7.12.0, Build: default/tar/78722783c38caa25a70982b5b042074cde5d3b3a/2021-03-18T06:17:15.410153305Z, JVM: 15.0.1
Plugins installed: []
JVM version (
java -version
):openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)
OS version (
uname -a
if on a Unix-like system):Darwin Georges-MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
Dates are not mapped correctly for seconds values having values less than
-999
.e.g. for the date in seconds value
-1000
the expected mapped date is1969-12-31T23:43:20.000Z
but the result I get is-1000-01-01T00:00:00.000Z
When I try with seconds value of
-9999999999
, I get this error:Steps to reproduce:
-1000
is incorrectly mapped as"-1000-01-01T00:00:00.000Z"
Result Seen:
-9999999999
expectingMonday, February 10, 1653 6:13:21 AM
Result Seen:
Provide logs (if relevant):
The text was updated successfully, but these errors were encountered: