Skip to content
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

[ESQL] Support basic casting for date nanos #109990

Open
6 tasks
Tracked by #109352
not-napoleon opened this issue Jun 20, 2024 · 1 comment
Open
6 tasks
Tracked by #109352

[ESQL] Support basic casting for date nanos #109990

not-napoleon opened this issue Jun 20, 2024 · 1 comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@not-napoleon
Copy link
Member

not-napoleon commented Jun 20, 2024

Description

The fastest way to get most functions to work with date nanos at all will be to cast them to a type we already support well. We'll also need a way to cast back to date nanos. There are three functions wrapped up into this ticket, because I think we'll need all three at once to sensibly test any of them. I might be wrong about that though, in which case we could break this down further.

  • TO_DATETIME should accept a date nanos and return a millisecond resolution time (NOTE: We need to have a rounding convention here)
  • TO_LONG should accept a date nanos and return the same value as a long
  • Add a new function TO_DATE_NANOS
    • Support long -> date nanos via direct conversion (i.e. value stays the same, type changes)
    • Support datetime -> date nanos via scaling (i.e. multiply by 1,000,000). Overflow will return null and generate a warning
    • Support string -> date nanos via parsing
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jun 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

2 participants