Skip to content

Commit

Permalink
back out workaround for autocasting
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Mar 29, 2024
1 parent 4bcca86 commit 8c0d42e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,21 +945,6 @@ public static List<TypedDataSupplier> dateCases() {
);
}

public static List<TypedDataSupplier> datesAsStringLiteralsCases() {
List<TypedDataSupplier> 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<TypedDataSupplier> datePeriodCases() {
return List.of(
new TypedDataSupplier("<zero date period>", () -> Period.ZERO, EsqlDataTypes.DATE_PERIOD),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,6 @@ public static Iterable<Object[]> parameters() {
)
);

suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"EqualsLongsEvaluator",
"lhs",
"rhs",
Object::equals,
DataTypes.BOOLEAN,
TestCaseSupplier.dateCases(),
TestCaseSupplier.datesAsStringLiteralsCases(),
List.of()
)
);

List<TestCaseSupplier.TypedDataSupplier> lhsSuppliers = new ArrayList<>();
List<TestCaseSupplier.TypedDataSupplier> rhsSuppliers = new ArrayList<>();
for (DataType type : AbstractConvertFunction.STRING_TYPES) {
Expand Down

0 comments on commit 8c0d42e

Please sign in to comment.