1212
1313import org .elasticsearch .common .time .DateUtils ;
1414import org .elasticsearch .core .Nullable ;
15+ import org .elasticsearch .xpack .esql .common .matchers .DateMillisMatcher ;
16+ import org .elasticsearch .xpack .esql .common .matchers .DateNanosMatcher ;
1517import org .elasticsearch .xpack .esql .core .expression .Expression ;
1618import org .elasticsearch .xpack .esql .core .tree .Source ;
1719import org .elasticsearch .xpack .esql .core .type .DataType ;
1820import org .elasticsearch .xpack .esql .expression .function .TestCaseSupplier ;
1921import org .elasticsearch .xpack .esql .expression .function .scalar .AbstractConfigurationFunctionTestCase ;
20- import org .elasticsearch .xpack .esql .expression .function .scalar .date .matchers .DateMillisMatcher ;
21- import org .elasticsearch .xpack .esql .expression .function .scalar .date .matchers .DateNanosMatcher ;
2222import org .elasticsearch .xpack .esql .session .Configuration ;
23- import org .hamcrest .BaseMatcher ;
2423import org .hamcrest .Matchers ;
2524
2625import java .time .Duration ;
3231import java .util .function .Supplier ;
3332
3433import static org .elasticsearch .xpack .esql .expression .function .TestCaseSupplier .TEST_SOURCE ;
35- import static org .elasticsearch .xpack .esql .type .EsqlDataTypeConverter .DEFAULT_DATE_TIME_FORMATTER ;
3634import static org .hamcrest .Matchers .equalTo ;
3735
3836/**
@@ -99,12 +97,12 @@ public static List<DurationTestCaseData> makeTruncDurationTestCases() {
9997 new DurationTestCaseData (Duration .ofMinutes (3 * 60 ), "2020-01-01T05:30:00Z" , "+01:00" , "2020-01-01T05:00:00Z" ),
10098
10199 // TODO: What to do with hours/minutes/seconds that are not divisors of a full day?
102- //new DurationTestCaseData(Duration.ofHours(5), "2020-01-01T05:30:00Z", "+01", "2020-01-01T05:00:00Z"),
100+ // new DurationTestCaseData(Duration.ofHours(5), "2020-01-01T05:30:00Z", "+01", "2020-01-01T05:00:00Z"),
103101
104102 ///
105103 /// Daylight savings
106104 ///
107- //- +1 -> +2 at 2025-03-30T02:00:00+01:00
105+ // - +1 -> +2 at 2025-03-30T02:00:00+01:00
108106 new DurationTestCaseData (Duration .ofHours (3 ), "2025-03-30T00:00:00+01:00" , "Europe/Paris" , "2025-03-30T00:00:00+01:00" ),
109107 new DurationTestCaseData (Duration .ofHours (3 ), "2025-03-30T01:00:00+01:00" , "Europe/Paris" , "2025-03-30T00:00:00+01:00" ),
110108 new DurationTestCaseData (Duration .ofHours (3 ), "2025-03-30T03:00:00+02:00" , "Europe/Paris" , "2025-03-30T03:00:00+02:00" ),
@@ -127,7 +125,7 @@ public static List<DurationTestCaseData> makeTruncDurationTestCases() {
127125 new DurationTestCaseData (Duration .ofMinutes (1 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T02:09:00+01:15" ),
128126 new DurationTestCaseData (Duration .ofMinutes (30 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T02:00:00+01:15" ),
129127 new DurationTestCaseData (Duration .ofHours (1 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T02:00:00+01:15" ),
130- new DurationTestCaseData (Duration .ofHours (3 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T00:00:00+01:15" ),
128+ new DurationTestCaseData (Duration .ofHours (3 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T00:00:00+01:15" ),
131129 new DurationTestCaseData (Duration .ofHours (24 ), "2025-10-26T02:09:09+01:15" , "+01:15" , "2025-10-26T00:00:00+01:15" )
132130 );
133131 }
0 commit comments