Skip to content

[7.14] [ML] Fix failure on datafeed preview with date_nanos time field (#77109)#77121

Merged
elasticsearchmachine merged 1 commit intoelastic:7.14from
dimitris-athanasiou:backport/7.14/pr-77109
Sep 1, 2021
Merged

[7.14] [ML] Fix failure on datafeed preview with date_nanos time field (#77109)#77121
elasticsearchmachine merged 1 commit intoelastic:7.14from
dimitris-athanasiou:backport/7.14/pr-77109

Conversation

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor

Backports the following commits to 7.14:

…tic#77109)

Preview datafeed currently fails when the time field is of type
`date_nanos`. The failure contains the error message:

```
date [...] is after 2262-04-11T23:47:16.854775807 and cannot be
stored in nanosecond resolution
```

This commit fixes this failure. The cause of the issue was that
preview generates a search with a range query on the time field
whose upper bound is `Long.MAX_VALUE` in order to include all
available data in the preview. However, that value is parsed
with `DateUtils.toLong` when the time field is `date_nanos` and
it hits the limitation that values can't be larger than
`DateUtils.MAX_NANOSECOND_INSTANT`. The fix checks whether the
time field is `date_nanos` and uses `DateUtils.MAX_NANOSECOND_INSTANT`
as the upper bound instead of `Long.MAX_VALUE`.
@dimitris-athanasiou dimitris-athanasiou added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport labels Sep 1, 2021
@elasticsearchmachine elasticsearchmachine merged commit 57e3a7c into elastic:7.14 Sep 1, 2021
@dimitris-athanasiou dimitris-athanasiou deleted the backport/7.14/pr-77109 branch September 1, 2021 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport v7.14.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants