-
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
Fields API can lose precision when fetching dates #70085
Comments
Pinging @elastic/es-search (Team:Search) |
I pulled that big number from the wikipedia page on double precision floating point numbers. It's a good read. |
OOOOOOH! Another place where just fetch the source and let jackson do whatever is in
|
Would this benefit from #46531? |
Probably
…On Mon, Mar 29, 2021, 06:14 Adrien Grand ***@***.***> wrote:
Would this benefit from #46531
<#46531>?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#70085 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABUXIUE777L3LF32NX3CHLTGBOIJANCNFSM4YZPXALA>
.
|
I think it'd make it possible to use the two code paths for parsing
successfully. But maybe we don't want to use the two code paths anyway and
should migrate to a from-x-content reader rather than from-map. Maybe.
Dunno!
…On Mon, Mar 29, 2021, 07:23 Nikolas Everett ***@***.***> wrote:
Probably
On Mon, Mar 29, 2021, 06:14 Adrien Grand ***@***.***> wrote:
> Would this benefit from #46531
> <#46531>?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#70085 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AABUXIUE777L3LF32NX3CHLTGBOIJANCNFSM4YZPXALA>
> .
>
|
A bunch of folks got together and thought about this for a while. We decided to do three things "real soon":
To well and truly fix this issue would require a bunch of breaking changes that we think would be rough on folks. Or it'd require a bunch of advancements in scripts that aren't "soon" things. |
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see elastic#70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them.
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see #70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them. Co-authored-by: Adrien Grand <[email protected]>
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see elastic#70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them. Co-authored-by: Adrien Grand <[email protected]>
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see elastic#70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them. Co-authored-by: Adrien Grand <[email protected]>
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see #70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them. Co-authored-by: Adrien Grand <[email protected]>
We accept dates with a decimal point like `2113413.13241324` and parse them *somehow*. But there are cases where we'll lose precision on those dates, see #70085. This advises folks not to use that format. We'll continue to accept those dates for backwards compatibility but you should avoid using them. Co-authored-by: Adrien Grand <[email protected]>
When can we expect the below action items to be addressed?
|
This issue stalled over time, I believe due to the breaking nature of some of the needed changes. We have been discussing though adding support for loading from stored fields as well as doc_values , which is not a direct fix for the precision loss, but it could help if we avoided loading from _source in this specific case. Sounds like a hack, but I thought I would bring it up to see what others think. |
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
We allow folks to specify dates like:
Which you should read as
6123123000
nanoseconds since epoch. There are a lot of layers, but when we see this format we pretty much shift the decimal point six places to the right and parse the whole thing as nanoseconds. Then we use the standard java time utilities to convert that nanosecond precision instant into whatever the date's native format is. This all works fine on parsing.But in a few places we let jackson deserialize the
_source
without type hints. When it sees a number like6123.123
it automatically converts it to a double precision floating point value. This will lose precision for big dates. Withdate
its mostly ok because double's maximum precise value is 9,007,199,254,740,992 which is something like the year 287396. If I live so long I'll be glad to fix the bugs. I say mostly here because there are some issues with rounding so we might end up being off by a millisecond. Sadly, withdate_nanos
we lose precision on any date after 6am, April 15th, 1970 UTC.So, you rightly ask, when do we let jackson deserialize the
_source
? Well, when scripts access_source
viaparams._source
. And when we perform an_update
action. And in thefields
API. And maybe other places I haven't found yet.Note: This describes the state we'll be in if we merge #70040.
The text was updated successfully, but these errors were encountered: