Commit graph

3 commits

Author SHA1 Message Date
Luigi Dell'Aquila
458dd4afe3
ES|QL: provide snapshot_only info for functions (Kibana) (#113544) (#113927)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-04 22:13:19 +10:00
Mark Tozzi
d2a89968ec
[ESQL] Add TO_DATE_NANOS conversion function (#112150) (#113641)
Resolves #111842

This adds a conversion function that yields DATE_NANOS. Mostly this is straight forward.

It is worth noting that when converting a millisecond date into a nanosecond date, the conversion function truncates it to 0 nanoseconds (i.e. first nanosecond of that millisecond). This is, of course, a bit of an assumption, but I don't have a better assumption we can make. I'd thought about adding a second, optional, parameter to control this behavior, but it's important that TO_DATE_NANOS extend AbstractConvertFunction, which itself extends UnaryScalarFunction, so that it will work correctly with union types. Also, it's unlikely the user will have any better guess than we do for filling in the nanoseconds.

Making that assumption does, however, create some weirdness. Consider two comparisons:

TO_DATETIME("2023-03-23T12:15:03.360103847") == TO_DATETIME("2023-03-23T12:15:03.360") will return true while TO_DATE_NANOS("2023-03-23T12:15:03.360103847") == TO_DATE_NANOS("2023-03-23T12:15:03.360") will return false. This is akin to casting between longs and doubles, where things may compare equal in one type that are not equal in the other. This seems fine, and I can't think of a better way to do it, but it's worth being aware of.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-27 22:59:55 +10:00
Carlos Delgado
c3a2b19993
[8.x] ESQL QSTR function (#112590) (#113189) 2024-09-23 10:13:53 +02:00