mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 15:47:23 -04:00
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> |
||
---|---|---|
.. | ||
functions | ||
processing-commands | ||
source-commands | ||
esql-across-clusters.asciidoc | ||
esql-apis.asciidoc | ||
esql-async-query-api.asciidoc | ||
esql-async-query-delete-api.asciidoc | ||
esql-async-query-get-api.asciidoc | ||
esql-commands.asciidoc | ||
esql-enrich-data.asciidoc | ||
esql-examples.asciidoc | ||
esql-functions-operators.asciidoc | ||
esql-get-started.asciidoc | ||
esql-kibana.asciidoc | ||
esql-language.asciidoc | ||
esql-limitations.asciidoc | ||
esql-multi-index.asciidoc | ||
esql-process-data-with-dissect-grok.asciidoc | ||
esql-query-api.asciidoc | ||
esql-rest.asciidoc | ||
esql-security-solution.asciidoc | ||
esql-syntax.asciidoc | ||
esql-using.asciidoc | ||
implicit-casting.asciidoc | ||
index.asciidoc | ||
metadata-fields.asciidoc | ||
multivalued-fields.asciidoc | ||
task-management.asciidoc |