Skip to content

Commit 654e6ce

Browse files
more tests around date functions
1 parent d0d46f6 commit 654e6ce

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

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

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,41 @@ emp_no:long | hire_date:date_nanos | yr:date_nanos | mo:date_nano
19331933
10002 | 1985-11-21T00:00:00.000Z | 1985-01-01T00:00:00.000Z | 1985-11-01T00:00:00.000Z
19341934
;
19351935

1936+
MultiTypedDateTruncStatsBy
1937+
required_capability: implicit_casting_union_typed_numeric_and_date
1938+
1939+
FROM employees, employees_incompatible
1940+
| STATS c = count(emp_no) BY yr = DATE_TRUNC(1 year, hire_date)
1941+
| SORT yr DESC
1942+
| LIMIT 5
1943+
;
1944+
1945+
c:long | yr:date_nanos
1946+
2 | 1999-01-01T00:00:00.000Z
1947+
2 | 1997-01-01T00:00:00.000Z
1948+
2 | 1996-01-01T00:00:00.000Z
1949+
10 | 1995-01-01T00:00:00.000Z
1950+
8 | 1994-01-01T00:00:00.000Z
1951+
;
1952+
1953+
MultiTypedDateTruncStatsByWithEval
1954+
required_capability: implicit_casting_union_typed_numeric_and_date
1955+
1956+
FROM employees, employees_incompatible
1957+
| EVAL yr = DATE_TRUNC(1 year, hire_date)
1958+
| STATS c = count(emp_no) BY yr
1959+
| SORT yr DESC
1960+
| LIMIT 5
1961+
;
1962+
1963+
c:long | yr:date_nanos
1964+
2 | 1999-01-01T00:00:00.000Z
1965+
2 | 1997-01-01T00:00:00.000Z
1966+
2 | 1996-01-01T00:00:00.000Z
1967+
10 | 1995-01-01T00:00:00.000Z
1968+
8 | 1994-01-01T00:00:00.000Z
1969+
;
1970+
19361971
MultiTypedBucketDateNanosByYear
19371972
required_capability: implicit_casting_union_typed_numeric_and_date
19381973

@@ -1983,6 +2018,55 @@ c:long | mo:date_nanos
19832018
22 | 1985-01-01T00:00:00.000Z
19842019
;
19852020

2021+
MultiTypedBucketDateNanosInBothStatsAndBy
2022+
required_capability: implicit_casting_union_typed_numeric_and_date
2023+
2024+
FROM employees, employees_incompatible
2025+
| STATS c = count(*), b = BUCKET(hire_date, 1 year) + 1 year BY yr = BUCKET(hire_date, 1 year)
2026+
| SORT yr DESC, c
2027+
;
2028+
2029+
c:long | b:date_nanos | yr:date_nanos
2030+
2 | 2000-01-01T00:00:00.000Z | 1999-01-01T00:00:00.000Z
2031+
2 | 1998-01-01T00:00:00.000Z | 1997-01-01T00:00:00.000Z
2032+
2 | 1997-01-01T00:00:00.000Z | 1996-01-01T00:00:00.000Z
2033+
10 | 1996-01-01T00:00:00.000Z | 1995-01-01T00:00:00.000Z
2034+
8 | 1995-01-01T00:00:00.000Z | 1994-01-01T00:00:00.000Z
2035+
6 | 1994-01-01T00:00:00.000Z | 1993-01-01T00:00:00.000Z
2036+
16 | 1993-01-01T00:00:00.000Z | 1992-01-01T00:00:00.000Z
2037+
12 | 1992-01-01T00:00:00.000Z | 1991-01-01T00:00:00.000Z
2038+
24 | 1991-01-01T00:00:00.000Z | 1990-01-01T00:00:00.000Z
2039+
26 | 1990-01-01T00:00:00.000Z | 1989-01-01T00:00:00.000Z
2040+
18 | 1989-01-01T00:00:00.000Z | 1988-01-01T00:00:00.000Z
2041+
30 | 1988-01-01T00:00:00.000Z | 1987-01-01T00:00:00.000Z
2042+
22 | 1987-01-01T00:00:00.000Z | 1986-01-01T00:00:00.000Z
2043+
22 | 1986-01-01T00:00:00.000Z | 1985-01-01T00:00:00.000Z
2044+
;
2045+
2046+
MultiTypedBucketDateNanosInBothStatsAndByWithAlias
2047+
required_capability: implicit_casting_union_typed_numeric_and_date
2048+
2049+
FROM employees, employees_incompatible
2050+
| STATS c = count(*), b = yr + 1 year BY yr = BUCKET(hire_date, 1 year)
2051+
| SORT yr DESC, c
2052+
;
2053+
2054+
c:long | b:date_nanos | yr:date_nanos
2055+
2 | 2000-01-01T00:00:00.000Z | 1999-01-01T00:00:00.000Z
2056+
2 | 1998-01-01T00:00:00.000Z | 1997-01-01T00:00:00.000Z
2057+
2 | 1997-01-01T00:00:00.000Z | 1996-01-01T00:00:00.000Z
2058+
10 | 1996-01-01T00:00:00.000Z | 1995-01-01T00:00:00.000Z
2059+
8 | 1995-01-01T00:00:00.000Z | 1994-01-01T00:00:00.000Z
2060+
6 | 1994-01-01T00:00:00.000Z | 1993-01-01T00:00:00.000Z
2061+
16 | 1993-01-01T00:00:00.000Z | 1992-01-01T00:00:00.000Z
2062+
12 | 1992-01-01T00:00:00.000Z | 1991-01-01T00:00:00.000Z
2063+
24 | 1991-01-01T00:00:00.000Z | 1990-01-01T00:00:00.000Z
2064+
26 | 1990-01-01T00:00:00.000Z | 1989-01-01T00:00:00.000Z
2065+
18 | 1989-01-01T00:00:00.000Z | 1988-01-01T00:00:00.000Z
2066+
30 | 1988-01-01T00:00:00.000Z | 1987-01-01T00:00:00.000Z
2067+
22 | 1987-01-01T00:00:00.000Z | 1986-01-01T00:00:00.000Z
2068+
22 | 1986-01-01T00:00:00.000Z | 1985-01-01T00:00:00.000Z
2069+
;
19862070

19872071
MultiTypedEnrichOnNumericField
19882072
required_capability: enrich_load

0 commit comments

Comments
 (0)