@@ -74,6 +74,15 @@ ROW date="1985-01-01T00:00:00Z"::datetime, zero=0::datetime
74741985-01-01T00:00:00.000Z|1970-01-01T00:00:00.000Z
7575;
7676
77+ convertToDate
78+ required_capability: casting_operator_for_date
79+ ROW date="1985-01-01T00:00:00Z"::date, zero=0::date
80+ ;
81+
82+ date:datetime | zero:datetime
83+ 1985-01-01T00:00:00.000Z|1970-01-01T00:00:00.000Z
84+ ;
85+
7786convertToVersion
7887required_capability: casting_operator
7988ROW ver="1.2.3"::version
@@ -351,3 +360,94 @@ z = birth_date + 3 hours + 3 minutes::time_duration, w = birth_date + (3 hours +
351360birth_date:datetime |x:datetime |y:datetime |z:datetime |w:datetime
3523611953-09-02T00:00:00Z |1953-09-02T03:00:00Z |1953-09-01T21:00:00Z |1953-09-02T03:03:00Z |1953-09-02T03:03:00Z
353362;
363+
364+ convertToDatePeriodWithDateCasting
365+ required_capability: cast_string_literal_to_temporal_amount
366+ required_capability: casting_operator_for_date
367+ row x = "2024-01-01"::date
368+ | eval y = x + "3 DAYS"::date_period
369+ ;
370+
371+ x:datetime |y:datetime
372+ 2024-01-01 |2024-01-04
373+ ;
374+
375+ convertToTimeDurationWithDateCasting
376+ required_capability: cast_string_literal_to_temporal_amount
377+ required_capability: casting_operator_for_date
378+ row x = "2024-01-01"::date
379+ | eval y = x + "3 hours"::time_duration
380+ ;
381+
382+ x:datetime |y:datetime
383+ 2024-01-01 |2024-01-01T03:00:00.000Z
384+ ;
385+
386+ convertToDatePeriodTimeDurationWithDateCasting
387+ required_capability: cast_string_literal_to_temporal_amount
388+ required_capability: casting_operator_for_date
389+ row x = "2024-01-01"::date + "3 hours"::time_duration, y = "2024-01-01"::date - to_timeduration("3 hours"),
390+ z = "2024-01-01"::date + "3 DAYS"::date_period, w = "2024-01-01"::date - to_dateperiod("3 days")
391+ | keep x, y, z, w;
392+
393+ x:datetime |y:datetime |z:datetime |w:datetime
394+ 2024-01-01T03:00:00.000Z |2023-12-31T21:00:00.000Z |2024-01-04T00:00:00.000Z |2023-12-29T00:00:00.000Z
395+ ;
396+
397+ convertToDatePeriodNestedWithDateCasting
398+ required_capability: cast_string_literal_to_temporal_amount
399+ required_capability: casting_operator_for_date
400+ row x = "2024-01-01"::date
401+ | eval y = x + to_dateperiod("3 days"::date_period)
402+ ;
403+
404+ x:datetime |y:datetime
405+ 2024-01-01 |2024-01-04
406+ ;
407+
408+ convertToTimeDurationNestedWithDateCasting
409+ required_capability: cast_string_literal_to_temporal_amount
410+ required_capability: casting_operator_for_date
411+ row x = "2024-01-01"::date
412+ | eval y = x + to_timeduration("3 hours"::time_duration)
413+ ;
414+
415+ x:datetime |y:datetime
416+ 2024-01-01 |2024-01-01T03:00:00.000Z
417+ ;
418+
419+ testEvalWithDateCasting
420+ required_capability: casting_operator_for_date
421+ row x = "1986-06-26T00:00:00.000Z"
422+ | eval y = x::date, z = y + 10 years
423+ ;
424+
425+ x:keyword | y:datetime | z:datetime
426+ 1986-06-26T00:00:00.000Z | 1986-06-26T00:00:00.000Z | 1996-06-26T00:00:00.000Z
427+ ;
428+
429+
430+ filteringWithDateCasting
431+ required_capability: casting_operator_for_date
432+ from employees
433+ | where birth_date < "2023-08-25T11:25:41.052Z"::date - 70 years
434+ | sort emp_no
435+ | keep emp_no, birth_date;
436+
437+ emp_no:integer | birth_date:datetime
438+ 10006 | 1953-04-20T00:00:00.000Z
439+ 10009 | 1952-04-19T00:00:00.000Z
440+ 10019 | 1953-01-23T00:00:00.000Z
441+ 10020 | 1952-12-24T00:00:00.000Z
442+ 10022 | 1952-07-08T00:00:00.000Z
443+ 10026 | 1953-04-03T00:00:00.000Z
444+ 10035 | 1953-02-08T00:00:00.000Z
445+ 10051 | 1953-07-28T00:00:00.000Z
446+ 10063 | 1952-08-06T00:00:00.000Z
447+ 10066 | 1952-11-13T00:00:00.000Z
448+ 10067 | 1953-01-07T00:00:00.000Z
449+ 10072 | 1952-05-15T00:00:00.000Z
450+ 10076 | 1952-06-13T00:00:00.000Z
451+ 10097 | 1952-02-27T00:00:00.000Z
452+ 10100 | 1953-04-21T00:00:00.000Z
453+ ;
0 commit comments