Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Dec 3, 2024
1 parent d4b9aa6 commit 072ae16
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,7 @@ private static long addMillis(Instant date, TemporalAmount period) {

private static long addNanos(Instant date, TemporalAmount period) {
return DateUtils.toLong(
Instant.from(
ZonedDateTime.ofInstant(date, org.elasticsearch.xpack.esql.core.util.DateUtils.UTC).plus(period)
)
Instant.from(ZonedDateTime.ofInstant(date, org.elasticsearch.xpack.esql.core.util.DateUtils.UTC).plus(period))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ private static Object subtractDatesAndTemporalAmount(Object lhs, Object rhs, ToL

private static long subtractNanos(Instant date, TemporalAmount period) {
return DateUtils.toLong(
Instant.from(
ZonedDateTime.ofInstant(date, org.elasticsearch.xpack.esql.core.util.DateUtils.UTC).minus(period)
)
Instant.from(ZonedDateTime.ofInstant(date, org.elasticsearch.xpack.esql.core.util.DateUtils.UTC).minus(period))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,43 +107,19 @@ public static Iterable<Object[]> parameters() {
)
);
// Datetime
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"GreaterThanOrEqualLongsEvaluator",
"lhs",
"rhs",
(lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isAfter(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
},
DataType.BOOLEAN,
TestCaseSupplier.dateCases(),
TestCaseSupplier.dateCases(),
List.of(),
false
)
);
suppliers.addAll(TestCaseSupplier.forBinaryNotCasting("GreaterThanOrEqualLongsEvaluator", "lhs", "rhs", (lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isAfter(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
}, DataType.BOOLEAN, TestCaseSupplier.dateCases(), TestCaseSupplier.dateCases(), List.of(), false));

suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"GreaterThanOrEqualLongsEvaluator",
"lhs",
"rhs",
(lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isAfter(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
},
DataType.BOOLEAN,
TestCaseSupplier.dateNanosCases(),
TestCaseSupplier.dateNanosCases(),
List.of(),
false
)
);
suppliers.addAll(TestCaseSupplier.forBinaryNotCasting("GreaterThanOrEqualLongsEvaluator", "lhs", "rhs", (lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isAfter(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
}, DataType.BOOLEAN, TestCaseSupplier.dateNanosCases(), TestCaseSupplier.dateNanosCases(), List.of(), false));

suppliers.addAll(
TestCaseSupplier.stringCases(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,43 +107,19 @@ public static Iterable<Object[]> parameters() {
)
);
// Datetime
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"LessThanOrEqualLongsEvaluator",
"lhs",
"rhs",
(lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isBefore(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
},
DataType.BOOLEAN,
TestCaseSupplier.dateCases(),
TestCaseSupplier.dateCases(),
List.of(),
false
)
);
suppliers.addAll(TestCaseSupplier.forBinaryNotCasting("LessThanOrEqualLongsEvaluator", "lhs", "rhs", (lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isBefore(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
}, DataType.BOOLEAN, TestCaseSupplier.dateCases(), TestCaseSupplier.dateCases(), List.of(), false));

suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"LessThanOrEqualLongsEvaluator",
"lhs",
"rhs",
(lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isBefore(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
},
DataType.BOOLEAN,
TestCaseSupplier.dateNanosCases(),
TestCaseSupplier.dateNanosCases(),
List.of(),
false
)
);
suppliers.addAll(TestCaseSupplier.forBinaryNotCasting("LessThanOrEqualLongsEvaluator", "lhs", "rhs", (lhs, rhs) -> {
if (lhs instanceof Instant l && rhs instanceof Instant r) {
return l.isBefore(r) || l.equals(r);
}
throw new UnsupportedOperationException("Got some weird types");
}, DataType.BOOLEAN, TestCaseSupplier.dateNanosCases(), TestCaseSupplier.dateNanosCases(), List.of(), false));

suppliers.addAll(
TestCaseSupplier.stringCases(
Expand Down

0 comments on commit 072ae16

Please sign in to comment.