Skip to content

Commit

Permalink
Tests now failing only on combination issues
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Feb 6, 2024
1 parent 698c041 commit e9f1096
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public EvalOperator.ExpressionEvaluator.Factory toEvaluator(Function<Expression,
if (commonType.equals(DataTypes.BOOLEAN)) {
return new EqualsBoolsEvaluator.Factory(source(), lhs, rhs);
}
if (DataTypes.isString(commonType)) {
if (DataTypes.isString(commonType) || commonType.equals(DataTypes.VERSION) || commonType.equals(DataTypes.IP)) {
return new EqualsKeywordsEvaluator.Factory(source(), lhs, rhs);
}
throw new EsqlIllegalArgumentException("Unsupported type " + left().dataType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,24 @@ protected static String typeErrorMessage(boolean includeOrdinal, List<Set<DataTy
),
"boolean or cartesian_point or datetime or geo_point or numeric or string"
),
Map.entry(
Set.of(
DataTypes.BOOLEAN,
DataTypes.DATETIME,
DataTypes.DOUBLE,
EsqlDataTypes.GEO_POINT,
EsqlDataTypes.GEO_SHAPE,
DataTypes.INTEGER,
DataTypes.IP,
DataTypes.KEYWORD,
DataTypes.LONG,
DataTypes.TEXT,
DataTypes.UNSIGNED_LONG,
DataTypes.VERSION,
DataTypes.NULL
),
"cartesian_point or datetime or geo_point or numeric or string"
),
Map.entry(Set.of(EsqlDataTypes.GEO_POINT, DataTypes.KEYWORD, DataTypes.TEXT, DataTypes.NULL), "geo_point or string"),
Map.entry(Set.of(EsqlDataTypes.CARTESIAN_POINT, DataTypes.KEYWORD, DataTypes.TEXT, DataTypes.NULL), "cartesian_point or string"),
Map.entry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public static List<TypedDataSupplier> doubleCases(double min, double max) {
return cases;
}

private static List<TypedDataSupplier> booleanCases() {
public static List<TypedDataSupplier> booleanCases() {
return List.of(
new TypedDataSupplier("<true>", () -> true, DataTypes.BOOLEAN),
new TypedDataSupplier("<false>", () -> false, DataTypes.BOOLEAN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,44 @@ public static Iterable<Object[]> parameters() {
List.of()
)
);
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"EqualsBoolsEvaluator",
"lhs",
"rhs",
Object::equals,
DataTypes.BOOLEAN,
TestCaseSupplier.booleanCases(),
TestCaseSupplier.booleanCases(),
List.of()
)
);
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"EqualsKeywordsEvaluator",
"lhs",
"rhs",
Object::equals,
DataTypes.BOOLEAN,
TestCaseSupplier.ipCases(),
TestCaseSupplier.ipCases(),
List.of()
)
);
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"EqualsKeywordsEvaluator",
"lhs",
"rhs",
Object::equals,
DataTypes.BOOLEAN,
TestCaseSupplier.versionCases(""),
TestCaseSupplier.versionCases(""),
List.of()
)
);
// Datetime
// TODO: I'm surprised this passes. Shouldn't there be a cast from DateTime to Long?
// TODO: I'm surprised this passes. Shouldn't there be a cast from DateTime to Long?
suppliers.addAll(
TestCaseSupplier.forBinaryNotCasting(
"EqualsLongsEvaluator",
Expand Down Expand Up @@ -130,7 +166,7 @@ public static Iterable<Object[]> parameters() {
)
);

return parameterSuppliersFromTypedData(suppliers);
return parameterSuppliersFromTypedData(errorsForCasesWithoutExamples(anyNullIsNull(true, suppliers)));
}

@Override
Expand Down

0 comments on commit e9f1096

Please sign in to comment.