Skip to content

[ESQL] Support autocasting to resolve types between nanosecond dates and millisecond dates #110009

Closed
@not-napoleon

Description

@not-napoleon

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions