Skip to content

Commit 650eed7

Browse files
committed
Add more tests
1 parent 74d31da commit 650eed7

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,3 +815,34 @@ c:long |b:date
815815
0 |null
816816
1 |1965-01-01T00:00:00.000Z
817817
;
818+
819+
bucketByYearInArbitraryIntervals
820+
FROM employees
821+
| STATS c = COUNT(*) BY b = BUCKET(birth_date, 4 year)
822+
| SORT c DESC
823+
| LIMIT 5
824+
;
825+
826+
c:long |b:date
827+
28 | 1953-01-01T00:00:00.000Z
828+
28 | 1957-01-01T00:00:00.000Z
829+
25 | 1961-01-01T00:00:00.000Z
830+
10 | null
831+
8 | 1949-01-01T00:00:00.000Z
832+
;
833+
834+
835+
bucketByMonthInArbitraryIntervals
836+
FROM employees
837+
| STATS c = COUNT(*) BY b = BUCKET(hire_date, 20 month)
838+
| SORT c DESC
839+
| LIMIT 5
840+
;
841+
842+
c:long |b:date
843+
20 | 1986-09-01T00:00:00.000Z
844+
20 | 1988-05-01T00:00:00.000Z
845+
19 | 1985-01-01T00:00:00.000Z
846+
15 | 1990-01-01T00:00:00.000Z
847+
13 | 1991-09-01T00:00:00.000Z
848+
;

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,3 +1495,31 @@ FROM employees
14951495
result:boolean
14961496
null
14971497
;
1498+
1499+
evalDateTruncYearInArbitraryIntervals
1500+
ROW x = ["1963-01-01", "1973-04-11", "1983-04-12", "2000-02-12"]::DATETIME
1501+
| MV_EXPAND x
1502+
| EVAL y = DATE_TRUNC(10 years, x)
1503+
;
1504+
1505+
x:date | y:date
1506+
1963-01-01T00:00:00.000Z | 1961-01-01T00:00:00.000Z
1507+
1973-04-11T00:00:00.000Z | 1971-01-01T00:00:00.000Z
1508+
1983-04-12T00:00:00.000Z | 1981-01-01T00:00:00.000Z
1509+
2000-02-12T00:00:00.000Z | 1991-01-01T00:00:00.000Z
1510+
;
1511+
1512+
evalDateTruncMonthInArbitraryIntervals
1513+
ROW x = ["1969-05-01", "1969-12-31", "1970-01-12", "2000-06-08"]::DATETIME
1514+
| MV_EXPAND x
1515+
| EVAL y = DATE_TRUNC(10 months, x)
1516+
;
1517+
1518+
x:date | y:date
1519+
1969-05-01T00:00:00.000Z | 1969-03-01T00:00:00.000Z
1520+
1969-12-31T00:00:00.000Z | 1969-03-01T00:00:00.000Z
1521+
1970-01-12T00:00:00.000Z | 1970-01-01T00:00:00.000Z
1522+
2000-06-08T00:00:00.000Z | 2000-01-01T00:00:00.000Z
1523+
;
1524+
1525+

0 commit comments

Comments
 (0)