Skip to content

Commit 13ab20d

Browse files
committed
More tests
1 parent da17f5d commit 13ab20d

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/convert.csv-spec

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,94 @@ z = birth_date + 3 hours + 3 minutes::time_duration, w = birth_date + (3 hours +
360360
birth_date:datetime |x:datetime |y:datetime |z:datetime |w:datetime
361361
1953-09-02T00:00:00Z |1953-09-02T03:00:00Z |1953-09-01T21:00:00Z |1953-09-02T03:03:00Z |1953-09-02T03:03:00Z
362362
;
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+
| sort emp_no
434+
| where birth_date < "2023-08-25T11:25:41.052Z"::date - 70 years
435+
| keep birth_date;
436+
437+
birth_date:datetime
438+
1953-04-20T00:00:00.000Z
439+
1952-04-19T00:00:00.000Z
440+
1953-01-23T00:00:00.000Z
441+
1952-12-24T00:00:00.000Z
442+
1952-07-08T00:00:00.000Z
443+
1953-04-03T00:00:00.000Z
444+
1953-02-08T00:00:00.000Z
445+
1953-07-28T00:00:00.000Z
446+
1952-08-06T00:00:00.000Z
447+
1952-11-13T00:00:00.000Z
448+
1953-01-07T00:00:00.000Z
449+
1952-05-15T00:00:00.000Z
450+
1952-06-13T00:00:00.000Z
451+
1952-02-27T00:00:00.000Z
452+
1953-04-21T00:00:00.000Z
453+
;

0 commit comments

Comments
 (0)