private boolean isSortCompatible(SelectScope scope, SqlNode node, boolean descending) { switch (node.getKind()) { case DESCENDING: return isSortCompatible(scope, ((SqlCall) node).getOperandList().get(0), true); } final SqlMonotonicity monotonicity = scope.getMonotonicity(node); switch (monotonicity) { case INCREASING: case STRICTLY_INCREASING: return !descending; case DECREASING: case STRICTLY_DECREASING: return descending; default: return false; } }
/** * Returns whether any of the given expressions are sorted. * * <p>If so, it can be the default ORDER BY clause for a WINDOW specification. * (This is an extension to the SQL standard for streaming.) */ static boolean containsMonotonic(SelectScope scope, SqlNodeList nodes) { for (SqlNode node : nodes) { if (!scope.getMonotonicity(node).mayRepeat()) { return true; } } return false; }
/** * Returns whether any of the given expressions are sorted. * * <p>If so, it can be the default ORDER BY clause for a WINDOW specification. * (This is an extension to the SQL standard for streaming.) */ static boolean containsMonotonic(SelectScope scope, SqlNodeList nodes) { for (SqlNode node : nodes) { if (!scope.getMonotonicity(node).mayRepeat()) { return true; } } return false; }
private boolean isSortCompatible(SelectScope scope, SqlNode node, boolean descending) { switch (node.getKind()) { case DESCENDING: return isSortCompatible(scope, ((SqlCall) node).getOperandList().get(0), true); } final SqlMonotonicity monotonicity = scope.getMonotonicity(node); switch (monotonicity) { case INCREASING: case STRICTLY_INCREASING: return !descending; case DECREASING: case STRICTLY_DECREASING: return descending; default: return false; } }
private boolean isSortCompatible(SelectScope scope, SqlNode node, boolean descending) { switch (node.getKind()) { case DESCENDING: return isSortCompatible(scope, ((SqlCall) node).getOperandList().get(0), true); } final SqlMonotonicity monotonicity = scope.getMonotonicity(node); switch (monotonicity) { case INCREASING: case STRICTLY_INCREASING: return !descending; case DECREASING: case STRICTLY_DECREASING: return descending; default: return false; } }