// check if there is other filters for SELECT MAX(X) FROM T WHERE [other prefix filter AND ] X > / >= ?
// but we should allow SELECT MAX(X) FROM T WHERE X = ?
if (sortDirection == SortDirectionType.DESC && ispn.getSortDirection() == SortDirectionType.INVALID) {
if (numberOfExprs > 1 ||
(numberOfExprs == 1 && aggExpr.bindingToIndexedExpression(exprs.get(0).getLeft()) == null)) {
return plan;
}
}
// have an upper bound: # of endingExpr is more than # of searchExpr