[#8300] Support MODE() and MEDIAN() in H2
This commit is contained in:
parent
942fff54e6
commit
9e40e28c13
@ -38,6 +38,7 @@
|
||||
package org.jooq;
|
||||
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.POSTGRES_9_4;
|
||||
|
||||
/**
|
||||
@ -69,6 +70,6 @@ public interface OrderedAggregateFunctionOfDeferredType {
|
||||
* Add an <code>WITHIN GROUP (ORDER BY ..)</code> clause to the ordered
|
||||
* aggregate function
|
||||
*/
|
||||
@Support({ POSTGRES_9_4 })
|
||||
@Support({ H2, POSTGRES_9_4 })
|
||||
<T> AggregateFilterStep<T> withinGroupOrderBy(OrderField<T> field);
|
||||
}
|
||||
|
||||
@ -17837,7 +17837,7 @@ public class DSL {
|
||||
/**
|
||||
* The <code>mode(field)</code> aggregate function.
|
||||
*/
|
||||
@Support({ POSTGRES_9_4 })
|
||||
@Support({ H2, POSTGRES_9_4 })
|
||||
public static <T> AggregateFunction<T> mode(Field<T> field) {
|
||||
return new org.jooq.impl.Function<T>(Term.MODE, nullSafeDataType(field), field);
|
||||
}
|
||||
@ -17845,7 +17845,7 @@ public class DSL {
|
||||
/**
|
||||
* Get the median over a numeric field: median(field).
|
||||
*/
|
||||
@Support({ CUBRID, HSQLDB, MARIADB, POSTGRES_9_4 })
|
||||
@Support({ CUBRID, H2, HSQLDB, MARIADB, POSTGRES_9_4 })
|
||||
public static AggregateFunction<BigDecimal> median(Field<? extends Number> field) {
|
||||
return new org.jooq.impl.Function<BigDecimal>(Term.MEDIAN, SQLDataType.NUMERIC, nullSafe(field));
|
||||
}
|
||||
@ -18155,7 +18155,7 @@ public class DSL {
|
||||
* The <code>mode() within group (oder by [order clause])</code> ordered
|
||||
* aggregate function.
|
||||
*/
|
||||
@Support({ POSTGRES_9_4 })
|
||||
@Support({ H2, POSTGRES_9_4 })
|
||||
public static OrderedAggregateFunctionOfDeferredType mode() {
|
||||
return new Mode();
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ class Function<T> extends AbstractField<T> implements
|
||||
|
||||
|
||||
|
||||
else if (term == MODE && ( ctx.family() == POSTGRES)) {
|
||||
else if (term == MODE && ( ctx.family() == H2 || ctx.family() == POSTGRES)) {
|
||||
ctx.visit(mode().withinGroupOrderBy(DSL.field("{0}", arguments.get(0))));
|
||||
}
|
||||
else if (term == MEDIAN && ( ctx.family() == POSTGRES)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user