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 autocasting to resolve types between nanosecond dates and millisecond dates #110009

Open
Tracked by #109352
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) team-discuss

Comments

@not-napoleon
Copy link
Member

Description

Discussion ticket for how mixed operations between millisecond dates and nanosecond dates should work. This behavior would cover binary comparisons and arithmetic operations between mixed millisecond and nanosecond dates, and possibly some functions (TBD). This is complicated, and getting it wrong potentially obligates us to support a bad choice for a long time in BWC.

Option 1 - cast to millisecond date automatically

  • This has the benefit that it will never overflow, but it loses precision. Effectively, equality becomes a range operation
  • Changing this down the road would be a breaking change

Option 2 - Cast to nanosecond date automatically

  • This can overflow, so an otherwise sensible comparison might just start returning nulls
  • Equality gets weird, since we'll just be multiplying the milliseconds by 1,000,000 so for the vast majority of nanosecond values they will never be equal.
  • Changing this down the road would be a breaking change

Option 3 - Don't auto cast anything, make the user pick the behavior they want

  • Explicit is better than implicit (i.e. Zen of Python compliant)
  • We could later add a default cast without it being breaking, as the explicit casts would still work
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jun 20, 2024
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) team-discuss
Projects
None yet
Development

No branches or pull requests

2 participants