@@ -237,9 +237,13 @@ private void checkSort(LogicalPlan p, Set<Failure> failures) {
237
237
private static void checkFilterConditionType (LogicalPlan p , Set <Failure > localFailures ) {
238
238
if (p instanceof Filter f ) {
239
239
Expression condition = f .condition ();
240
- if (condition .dataType () != BOOLEAN ) {
241
- localFailures .add (fail (condition , "Condition expression needs to be boolean, found [{}]" , condition .dataType ()));
242
- }
240
+ checkConditionExpressionDataType (condition , localFailures );
241
+ }
242
+ }
243
+
244
+ private static void checkConditionExpressionDataType (Expression expression , Set <Failure > localFailures ) {
245
+ if (expression .dataType () != NULL && expression .dataType () != BOOLEAN ) {
246
+ localFailures .add (fail (expression , "Condition expression needs to be boolean, found [{}]" , expression .dataType ()));
243
247
}
244
248
}
245
249
@@ -432,9 +436,7 @@ private static void checkInvalidNamedExpressionUsage(
432
436
}
433
437
Expression f = fe .filter ();
434
438
// check the filter has to be a boolean term, similar as checkFilterConditionType
435
- if (f .dataType () != NULL && f .dataType () != BOOLEAN ) {
436
- failures .add (fail (f , "Condition expression needs to be boolean, found [{}]" , f .dataType ()));
437
- }
439
+ checkConditionExpressionDataType (f , failures );
438
440
// but that the filter doesn't use grouping or aggregate functions
439
441
fe .filter ().forEachDown (c -> {
440
442
if (c instanceof AggregateFunction af ) {
0 commit comments