[jOOQ/jOOQ#15190] DISTINCT .. WITH TIES emulation renders too many DENSE_RANK() OVER (ORDER BY ...) clauses
This commit is contained in:
parent
6d94ccea9b
commit
ac9aa44b09
@ -2142,7 +2142,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
|
||||
private final Field<Integer> limitWindowFunction(Context<?> c) {
|
||||
return distinct
|
||||
? DSL.denseRank().over(orderBy(getNonEmptyOrderByForDistinct(c.configuration())))
|
||||
? DSL.denseRank().over(orderBy(getNonEmptyOrderBy(c.configuration())))
|
||||
: getLimit().withTies()
|
||||
? DSL.rank().over(orderBy(getNonEmptyOrderBy(c.configuration())))
|
||||
: DSL.rowNumber().over(orderBy(getNonEmptyOrderBy(c.configuration())));
|
||||
@ -4440,16 +4440,6 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
return getOrderBy();
|
||||
}
|
||||
|
||||
final SortFieldList getNonEmptyOrderByForDistinct(Configuration configuration) {
|
||||
SortFieldList order = new SortFieldList();
|
||||
order.addAll(getNonEmptyOrderBy(configuration));
|
||||
|
||||
for (Field<?> field : getSelect())
|
||||
order.add(field.asc());
|
||||
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addOrderBy(Collection<? extends OrderField<?>> fields) {
|
||||
getOrderBy().addAll(Tools.sortFields(fields));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user