Skip to content

Commit ad32a98

Browse files
committed
Moved matchers to a common place
1 parent dd523d5 commit ad32a98

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers;
8+
package org.elasticsearch.xpack.esql.common.matchers;
99

1010
import org.hamcrest.BaseMatcher;
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers;
8+
package org.elasticsearch.xpack.esql.common.matchers;
99

1010
import org.elasticsearch.common.time.DateUtils;
1111
import org.hamcrest.BaseMatcher;

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/grouping/BucketTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
import org.elasticsearch.common.time.DateUtils;
1616
import org.elasticsearch.index.mapper.DateFieldMapper;
1717
import org.elasticsearch.logging.LogManager;
18+
import org.elasticsearch.xpack.esql.common.matchers.DateMillisMatcher;
19+
import org.elasticsearch.xpack.esql.common.matchers.DateNanosMatcher;
1820
import org.elasticsearch.xpack.esql.core.expression.Expression;
1921
import org.elasticsearch.xpack.esql.core.tree.Source;
2022
import org.elasticsearch.xpack.esql.core.type.DataType;
2123
import org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry;
2224
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
2325
import org.elasticsearch.xpack.esql.expression.function.scalar.AbstractConfigurationFunctionTestCase;
24-
import org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers.DateMillisMatcher;
25-
import org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers.DateNanosMatcher;
2626
import org.elasticsearch.xpack.esql.session.Configuration;
2727
import org.hamcrest.Matcher;
2828
import org.hamcrest.Matchers;

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/grouping/TBucketTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
import org.elasticsearch.common.time.DateUtils;
1515
import org.elasticsearch.index.mapper.DateFieldMapper;
1616
import org.elasticsearch.logging.LogManager;
17+
import org.elasticsearch.xpack.esql.common.matchers.DateMillisMatcher;
18+
import org.elasticsearch.xpack.esql.common.matchers.DateNanosMatcher;
1719
import org.elasticsearch.xpack.esql.core.expression.Expression;
1820
import org.elasticsearch.xpack.esql.core.tree.Source;
1921
import org.elasticsearch.xpack.esql.core.type.DataType;
2022
import org.elasticsearch.xpack.esql.expression.function.DocsV3Support;
2123
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
2224
import org.elasticsearch.xpack.esql.expression.function.scalar.AbstractConfigurationFunctionTestCase;
23-
import org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers.DateMillisMatcher;
24-
import org.elasticsearch.xpack.esql.expression.function.scalar.date.matchers.DateNanosMatcher;
2525
import org.elasticsearch.xpack.esql.session.Configuration;
2626
import org.hamcrest.Matcher;
2727
import org.hamcrest.Matchers;

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateTruncTests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313
import org.elasticsearch.common.time.DateUtils;
1414
import org.elasticsearch.core.Nullable;
15+
import org.elasticsearch.xpack.esql.common.matchers.DateMillisMatcher;
16+
import org.elasticsearch.xpack.esql.common.matchers.DateNanosMatcher;
1517
import org.elasticsearch.xpack.esql.core.expression.Expression;
1618
import org.elasticsearch.xpack.esql.core.tree.Source;
1719
import org.elasticsearch.xpack.esql.core.type.DataType;
1820
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
1921
import 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;
2222
import org.elasticsearch.xpack.esql.session.Configuration;
23-
import org.hamcrest.BaseMatcher;
2423
import org.hamcrest.Matchers;
2524

2625
import java.time.Duration;
@@ -32,7 +31,6 @@
3231
import java.util.function.Supplier;
3332

3433
import static org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier.TEST_SOURCE;
35-
import static org.elasticsearch.xpack.esql.type.EsqlDataTypeConverter.DEFAULT_DATE_TIME_FORMATTER;
3634
import 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

Comments
 (0)