diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/predicate/operator/comparison/EsqlBinaryComparison.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/predicate/operator/comparison/EsqlBinaryComparison.java index 71c487b567344..1750c4bd8f1e1 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/predicate/operator/comparison/EsqlBinaryComparison.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/evaluator/predicate/operator/comparison/EsqlBinaryComparison.java @@ -123,12 +123,6 @@ protected TypeResolution checkCompatibility() { return new TypeResolution(formatIncompatibleTypesMessage()); } - // String literals (and only literals) can be cast up to dates - if ((DataTypes.isDateTime(leftType) && DataTypes.isString(rightType) && right() instanceof Literal) - || (DataTypes.isDateTime(rightType) && DataTypes.isString(leftType) && left() instanceof Literal)) { - return TypeResolution.TYPE_RESOLVED; - } - if ((leftType.isNumeric() && rightType.isNumeric()) || (DataTypes.isString(leftType) && DataTypes.isString(rightType)) || leftType.equals(rightType) diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java index 554f3622577ca..af84dfc1a08e2 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/TestCaseSupplier.java @@ -945,21 +945,6 @@ public static List dateCases() { ); } - public static List datesAsStringLiteralsCases() { - List cases = new ArrayList<>(); - for (TypedDataSupplier dateCase : dateCases()) { - cases.add( - new TypedDataSupplier( - "<" + dateCase.name + "as string>", - () -> EsqlDataTypeConverter.dateTimeToString((long) dateCase.supplier.get()), - DataTypes.KEYWORD, - true - ) - ); - } - return cases; - } - public static List datePeriodCases() { return List.of( new TypedDataSupplier("", () -> Period.ZERO, EsqlDataTypes.DATE_PERIOD), diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java index de53195cc0581..1e011d5c915bb 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java @@ -128,19 +128,6 @@ public static Iterable parameters() { ) ); - suppliers.addAll( - TestCaseSupplier.forBinaryNotCasting( - "EqualsLongsEvaluator", - "lhs", - "rhs", - Object::equals, - DataTypes.BOOLEAN, - TestCaseSupplier.dateCases(), - TestCaseSupplier.datesAsStringLiteralsCases(), - List.of() - ) - ); - List lhsSuppliers = new ArrayList<>(); List rhsSuppliers = new ArrayList<>(); for (DataType type : AbstractConvertFunction.STRING_TYPES) {