Skip to content

Commit

Permalink
Replace "::<type>" casts to explicit casting functions (elastic#114639)
Browse files Browse the repository at this point in the history
Fixes elastic#114613

Those tests were added with `::<type>` casts, which don't work in older versions.

As they aren't testing anything around those casts, I'm replacing them with `TO_<TYPE>()` functions to let them work everywhere.
  • Loading branch information
ivancea authored Oct 11, 2024
1 parent e56f24f commit f77611c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ date1:date | dd_ms:integer

evalDateDiffMonthAsWhole0Months

ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-01-01T00:00:00"::DATETIME
ROW from=TO_DATETIME("2023-12-31T23:59:59.999Z"), to=TO_DATETIME("2024-01-01T00:00:00")
| EVAL msecs=DATE_DIFF("milliseconds", from, to), months=DATE_DIFF("month", from, to)
;

Expand All @@ -380,7 +380,7 @@ ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-01-01T00:00:00"::DATETIM

evalDateDiffMonthAsWhole1Month

ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-02-01T00:00:00"::DATETIME
ROW from=TO_DATETIME("2023-12-31T23:59:59.999Z"), to=TO_DATETIME("2024-02-01T00:00:00")
| EVAL secs=DATE_DIFF("seconds", from, to), months=DATE_DIFF("month", from, to)
;

Expand All @@ -392,7 +392,7 @@ ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-02-01T00:00:00"::DATETIM
evalDateDiffYearAsWhole0Years
required_capability: date_diff_year_calendarial

ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-01-01T00:00:00"::DATETIME
ROW from=TO_DATETIME("2023-12-31T23:59:59.999Z"), to=TO_DATETIME("2024-01-01T00:00:00")
| EVAL msecs=DATE_DIFF("milliseconds", from, to), years=DATE_DIFF("year", from, to)
;

Expand All @@ -403,7 +403,7 @@ ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2024-01-01T00:00:00"::DATETIM
evalDateDiffYearAsWhole1Year
required_capability: date_diff_year_calendarial

ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2025-01-01T00:00:00"::DATETIME
ROW from=TO_DATETIME("2023-12-31T23:59:59.999Z"), to=TO_DATETIME("2025-01-01T00:00:00")
| EVAL secs=DATE_DIFF("seconds", from, to), years=DATE_DIFF("year", from, to)
;

Expand All @@ -414,7 +414,7 @@ ROW from="2023-12-31T23:59:59.999Z"::DATETIME, to="2025-01-01T00:00:00"::DATETIM
evalDateDiffYearAsWhole1Year
required_capability: date_diff_year_calendarial

ROW from="2024-01-01T00:00:00Z"::DATETIME, to="2025-01-01T00:00:00"::DATETIME
ROW from=TO_DATETIME("2024-01-01T00:00:00Z"), to=TO_DATETIME("2025-01-01T00:00:00")
| EVAL secs=DATE_DIFF("seconds", from, to), years=DATE_DIFF("year", from, to)
;

Expand All @@ -426,9 +426,9 @@ evalDateDiffYearForDocs
required_capability: date_diff_year_calendarial

// tag::evalDateDiffYearForDocs[]
ROW end_23="2023-12-31T23:59:59.999Z"::DATETIME,
start_24="2024-01-01T00:00:00.000Z"::DATETIME,
end_24="2024-12-31T23:59:59.999"::DATETIME
ROW end_23=TO_DATETIME("2023-12-31T23:59:59.999Z"),
start_24=TO_DATETIME("2024-01-01T00:00:00.000Z"),
end_24=TO_DATETIME("2024-12-31T23:59:59.999")
| EVAL end23_to_start24=DATE_DIFF("year", end_23, start_24)
| EVAL end23_to_end24=DATE_DIFF("year", end_23, end_24)
| EVAL start_to_end_24=DATE_DIFF("year", start_24, end_24)
Expand Down

0 comments on commit f77611c

Please sign in to comment.