Skip to content

Commit

Permalink
Even better
Browse files Browse the repository at this point in the history
  • Loading branch information
luigidellaquila committed Nov 22, 2024
1 parent c2ef14d commit 3268f1b
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ Collection<Failure> verify(LogicalPlan plan, BitSet partialMetrics) {
}
// p is resolved, skip
else if (p.resolved()) {
if (p instanceof OrderBy ob) {
ob.order().forEach(o -> {
o.forEachDown(Function.class, f -> {
if (f instanceof AggregateFunction) {
failures.add(fail(f, "Aggregate functions are not allowed in SORT [{}]", f.functionName()));
}
});
});
}
p.forEachExpressionUp(Alias.class, a -> aliases.put(a.toAttribute(), a.child()));
return;
}
Expand Down Expand Up @@ -224,6 +215,7 @@ else if (p instanceof Lookup lookup) {
checkOperationsOnUnsignedLong(p, failures);
checkBinaryComparison(p, failures);
checkForSortableDataTypes(p, failures);
checkSort(p, failures);

checkFullTextQueryFunctions(p, failures);
});
Expand All @@ -241,6 +233,18 @@ else if (p instanceof Lookup lookup) {
return failures;
}

private void checkSort(LogicalPlan p, Set<Failure> failures) {
if (p instanceof OrderBy ob) {
ob.order().forEach(o -> {
o.forEachDown(Function.class, f -> {
if (f instanceof AggregateFunction) {
failures.add(fail(f, "Aggregate functions are not allowed in SORT [{}]", f.functionName()));
}
});
});
}
}

private static void checkFilterConditionType(LogicalPlan p, Set<Failure> localFailures) {
if (p instanceof Filter f) {
Expression condition = f.condition();
Expand Down

0 comments on commit 3268f1b

Please sign in to comment.