[jOOQ/jOOQ#15906] Add QOM API for hypothetical set functions
This includes: - [jOOQ/jOOQ#16801] Change PERCENT_RANK hypothetical set function to return BigDecimal instead of Integer
This commit is contained in:
parent
0d408bdeba
commit
0bfbeca38d
@ -142,6 +142,14 @@ implements
|
||||
}
|
||||
|
||||
AbstractAggregateFunction(boolean distinct, Name name, DataType<T> type, Field<?>... arguments) {
|
||||
this(distinct, name, type, Arrays.asList(arguments));
|
||||
}
|
||||
|
||||
AbstractAggregateFunction(boolean distinct, String name, DataType<T> type, Collection<? extends Field<?>> arguments) {
|
||||
this(distinct, DSL.unquotedName(name), type, arguments);
|
||||
}
|
||||
|
||||
AbstractAggregateFunction(boolean distinct, Name name, DataType<T> type, Collection<? extends Field<?>> arguments) {
|
||||
super(name, type);
|
||||
|
||||
this.distinct = distinct;
|
||||
|
||||
157
jOOQ/src/main/java/org/jooq/impl/CumeDistAgg.java
Normal file
157
jOOQ/src/main/java/org/jooq/impl/CumeDistAgg.java
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
|
||||
* database integrations.
|
||||
*
|
||||
* For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.*;
|
||||
import static org.jooq.impl.Internal.*;
|
||||
import static org.jooq.impl.Keywords.*;
|
||||
import static org.jooq.impl.Names.*;
|
||||
import static org.jooq.impl.SQLDataType.*;
|
||||
import static org.jooq.impl.Tools.*;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.*;
|
||||
import static org.jooq.impl.Tools.ExtendedDataKey.*;
|
||||
import static org.jooq.impl.Tools.SimpleDataKey.*;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import org.jooq.*;
|
||||
import org.jooq.Function1;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>CUME DIST</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class CumeDistAgg
|
||||
extends
|
||||
AbstractAggregateFunction<BigDecimal>
|
||||
implements
|
||||
QOM.CumeDistAgg
|
||||
{
|
||||
|
||||
CumeDistAgg(
|
||||
Collection<? extends Field<?>> fields
|
||||
) {
|
||||
super(
|
||||
false,
|
||||
N_CUME_DIST,
|
||||
NUMERIC,
|
||||
fields
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
super.accept(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final QOM.UnmodifiableList<? extends Field<?>> $fields() {
|
||||
return QOM.unmodifiable(getArguments());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.CumeDistAgg $fields(Collection<? extends Field<?>> newValue) {
|
||||
return $constructor().apply(newValue);
|
||||
}
|
||||
|
||||
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.CumeDistAgg> $constructor() {
|
||||
return (a1) -> new CumeDistAgg((Collection<? extends Field<?>>) a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.CumeDistAgg o) {
|
||||
return
|
||||
StringUtils.equals($fields(), o.$fields())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
@ -24915,6 +24915,94 @@ public class DSL {
|
||||
return new Product(field, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RANK</code> function.
|
||||
* <p>
|
||||
* The <code>RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> rank(Field<?>... fields) {
|
||||
return new RankAgg(Arrays.asList(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RANK</code> function.
|
||||
* <p>
|
||||
* The <code>RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> rank(Collection<? extends Field<?>> fields) {
|
||||
return new RankAgg(new QueryPartList<>(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DENSE_RANK</code> function.
|
||||
* <p>
|
||||
* The <code>DENSE_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> denseRank(Field<?>... fields) {
|
||||
return new DenseRankAgg(Arrays.asList(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DENSE_RANK</code> function.
|
||||
* <p>
|
||||
* The <code>DENSE_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> denseRank(Collection<? extends Field<?>> fields) {
|
||||
return new DenseRankAgg(new QueryPartList<>(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>PERCENT_RANK</code> function.
|
||||
* <p>
|
||||
* The <code>PERCENT_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> percentRank(Field<?>... fields) {
|
||||
return new PercentRankAgg(Arrays.asList(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>PERCENT_RANK</code> function.
|
||||
* <p>
|
||||
* The <code>PERCENT_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> percentRank(Collection<? extends Field<?>> fields) {
|
||||
return new PercentRankAgg(new QueryPartList<>(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CUME_DIST</code> function.
|
||||
* <p>
|
||||
* The <code>CUME_DIST</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> cumeDist(Field<?>... fields) {
|
||||
return new CumeDistAgg(Arrays.asList(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CUME_DIST</code> function.
|
||||
* <p>
|
||||
* The <code>CUME_DIST</code> hypothetical set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> cumeDist(Collection<? extends Field<?>> fields) {
|
||||
return new CumeDistAgg(new QueryPartList<>(fields));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>PERCENTILE_CONT</code> function.
|
||||
* <p>
|
||||
@ -32298,86 +32386,6 @@ public class DSL {
|
||||
return new ModeDeferred();
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> rank(Field<?>... fields) {
|
||||
return new DefaultAggregateFunction<>(N_RANK, SQLDataType.INTEGER, fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> rank(Collection<? extends Field<?>> fields) {
|
||||
return new DefaultAggregateFunction<>(N_RANK, SQLDataType.INTEGER, fields.toArray(EMPTY_FIELD));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>dense_rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> denseRank(Field<?>... fields) {
|
||||
return new DefaultAggregateFunction<>(N_DENSE_RANK, SQLDataType.INTEGER, fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>dense_rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> denseRank(Collection<? extends Field<?>> fields) {
|
||||
return new DefaultAggregateFunction<>(N_DENSE_RANK, SQLDataType.INTEGER, fields.toArray(EMPTY_FIELD));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>percent_rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> percentRank(Field<?>... fields) {
|
||||
return new DefaultAggregateFunction<>(N_PERCENT_RANK, SQLDataType.INTEGER, fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>percent_rank(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<Integer> percentRank(Collection<? extends Field<?>> fields) {
|
||||
return new DefaultAggregateFunction<>(N_PERCENT_RANK, SQLDataType.INTEGER, fields.toArray(EMPTY_FIELD));
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>cume_dist(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> cumeDist(Field<?>... fields) {
|
||||
return new DefaultAggregateFunction<>(N_CUME_DIST, SQLDataType.NUMERIC, fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>cume_dist(expr) within group (order by [order clause])</code>
|
||||
* ordered-set aggregate function.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ H2, POSTGRES, YUGABYTEDB })
|
||||
public static OrderedAggregateFunction<BigDecimal> cumeDist(Collection<? extends Field<?>> fields) {
|
||||
return new DefaultAggregateFunction<>(N_CUME_DIST, SQLDataType.NUMERIC, fields.toArray(EMPTY_FIELD));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX Window clauses
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
156
jOOQ/src/main/java/org/jooq/impl/DenseRankAgg.java
Normal file
156
jOOQ/src/main/java/org/jooq/impl/DenseRankAgg.java
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
|
||||
* database integrations.
|
||||
*
|
||||
* For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.*;
|
||||
import static org.jooq.impl.Internal.*;
|
||||
import static org.jooq.impl.Keywords.*;
|
||||
import static org.jooq.impl.Names.*;
|
||||
import static org.jooq.impl.SQLDataType.*;
|
||||
import static org.jooq.impl.Tools.*;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.*;
|
||||
import static org.jooq.impl.Tools.ExtendedDataKey.*;
|
||||
import static org.jooq.impl.Tools.SimpleDataKey.*;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import org.jooq.*;
|
||||
import org.jooq.Function1;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The <code>DENSE RANK</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class DenseRankAgg
|
||||
extends
|
||||
AbstractAggregateFunction<Integer>
|
||||
implements
|
||||
QOM.DenseRankAgg
|
||||
{
|
||||
|
||||
DenseRankAgg(
|
||||
Collection<? extends Field<?>> fields
|
||||
) {
|
||||
super(
|
||||
false,
|
||||
N_DENSE_RANK,
|
||||
INTEGER,
|
||||
fields
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
super.accept(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final QOM.UnmodifiableList<? extends Field<?>> $fields() {
|
||||
return QOM.unmodifiable(getArguments());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.DenseRankAgg $fields(Collection<? extends Field<?>> newValue) {
|
||||
return $constructor().apply(newValue);
|
||||
}
|
||||
|
||||
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.DenseRankAgg> $constructor() {
|
||||
return (a1) -> new DenseRankAgg((Collection<? extends Field<?>>) a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.DenseRankAgg o) {
|
||||
return
|
||||
StringUtils.equals($fields(), o.$fields())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,6 @@ final class Names {
|
||||
static final Name N_covarPop = systemName("covarPop");
|
||||
static final Name N_covarSamp = systemName("covarSamp");
|
||||
static final Name N_CUBE = systemName("cube");
|
||||
static final Name N_CUME_DIST = systemName("cume_dist");
|
||||
static final Name N_CURRENT_BIGDATETIME = systemName("current_bigdatetime");
|
||||
static final Name N_CURRENT_DATE = systemName("current_date");
|
||||
static final Name N_CURRENT_TIME = systemName("current_time");
|
||||
@ -118,7 +117,6 @@ final class Names {
|
||||
static final Name N_DECODE_ORACLE = systemName("decode_oracle");
|
||||
static final Name N_DEFAULT = systemName("default");
|
||||
static final Name N_DELETED = systemName("deleted");
|
||||
static final Name N_DENSE_RANK = systemName("dense_rank");
|
||||
static final Name N_DIV = systemName("div");
|
||||
static final Name N_DUAL = systemName("dual");
|
||||
static final Name N_ELEMENT_AT = systemName("element_at");
|
||||
@ -234,13 +232,11 @@ final class Names {
|
||||
static final Name N_ORDINAL = systemName("ordinal");
|
||||
static final Name N_OREPLACE = systemName("oreplace");
|
||||
static final Name N_PARSE_JSON = systemName("parse_json");
|
||||
static final Name N_PERCENT_RANK = systemName("percent_rank");
|
||||
static final Name N_PIVOT = systemName("pivot");
|
||||
static final Name N_PLPGSQL = systemName("plpgsql");
|
||||
static final Name N_PLUS = systemName("plus");
|
||||
static final Name N_POWER = systemName("power");
|
||||
static final Name N_RANDOMBLOB = systemName("randomblob");
|
||||
static final Name N_RANK = systemName("rank");
|
||||
static final Name N_RATIO_TO_REPORT = systemName("ratio_to_report");
|
||||
static final Name N_RAWTOHEX = systemName("rawtohex");
|
||||
static final Name N_RECORD = systemName("record");
|
||||
@ -444,6 +440,7 @@ final class Names {
|
||||
static final Name N_COUNT = systemName("count");
|
||||
static final Name N_COVAR_POP = systemName("covar_pop");
|
||||
static final Name N_COVAR_SAMP = systemName("covar_samp");
|
||||
static final Name N_CUME_DIST = systemName("cume_dist");
|
||||
static final Name N_CURRENTUSER = systemName("currentuser");
|
||||
static final Name N_CURRENT_CATALOG = systemName("current_catalog");
|
||||
static final Name N_CURRENT_DATABASE = systemName("current_database");
|
||||
@ -456,6 +453,7 @@ final class Names {
|
||||
static final Name N_DB_NAME = systemName("db_name");
|
||||
static final Name N_DEGREES = systemName("degrees");
|
||||
static final Name N_DELETING = systemName("deleting");
|
||||
static final Name N_DENSE_RANK = systemName("dense_rank");
|
||||
static final Name N_DIGITS = systemName("digits");
|
||||
static final Name N_E = systemName("e");
|
||||
static final Name N_EXCLUDED = systemName("excluded");
|
||||
@ -546,6 +544,7 @@ final class Names {
|
||||
static final Name N_OVERLAY = systemName("overlay");
|
||||
static final Name N_PERCENTILE_CONT = systemName("percentile_cont");
|
||||
static final Name N_PERCENTILE_DISC = systemName("percentile_disc");
|
||||
static final Name N_PERCENT_RANK = systemName("percent_rank");
|
||||
static final Name N_PI = systemName("pi");
|
||||
static final Name N_POSITION = systemName("position");
|
||||
static final Name N_POW = systemName("pow");
|
||||
@ -556,6 +555,7 @@ final class Names {
|
||||
static final Name N_RAND = systemName("rand");
|
||||
static final Name N_RANDOM = systemName("random");
|
||||
static final Name N_RANDOM_UUID = systemName("random_uuid");
|
||||
static final Name N_RANK = systemName("rank");
|
||||
static final Name N_REGR_AVGX = systemName("regr_avgx");
|
||||
static final Name N_REGR_AVGY = systemName("regr_avgy");
|
||||
static final Name N_REGR_COUNT = systemName("regr_count");
|
||||
|
||||
157
jOOQ/src/main/java/org/jooq/impl/PercentRankAgg.java
Normal file
157
jOOQ/src/main/java/org/jooq/impl/PercentRankAgg.java
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
|
||||
* database integrations.
|
||||
*
|
||||
* For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.*;
|
||||
import static org.jooq.impl.Internal.*;
|
||||
import static org.jooq.impl.Keywords.*;
|
||||
import static org.jooq.impl.Names.*;
|
||||
import static org.jooq.impl.SQLDataType.*;
|
||||
import static org.jooq.impl.Tools.*;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.*;
|
||||
import static org.jooq.impl.Tools.ExtendedDataKey.*;
|
||||
import static org.jooq.impl.Tools.SimpleDataKey.*;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import org.jooq.*;
|
||||
import org.jooq.Function1;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* The <code>PERCENT RANK</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class PercentRankAgg
|
||||
extends
|
||||
AbstractAggregateFunction<BigDecimal>
|
||||
implements
|
||||
QOM.PercentRankAgg
|
||||
{
|
||||
|
||||
PercentRankAgg(
|
||||
Collection<? extends Field<?>> fields
|
||||
) {
|
||||
super(
|
||||
false,
|
||||
N_PERCENT_RANK,
|
||||
NUMERIC,
|
||||
fields
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
super.accept(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final QOM.UnmodifiableList<? extends Field<?>> $fields() {
|
||||
return QOM.unmodifiable(getArguments());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.PercentRankAgg $fields(Collection<? extends Field<?>> newValue) {
|
||||
return $constructor().apply(newValue);
|
||||
}
|
||||
|
||||
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.PercentRankAgg> $constructor() {
|
||||
return (a1) -> new PercentRankAgg((Collection<? extends Field<?>>) a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.PercentRankAgg o) {
|
||||
return
|
||||
StringUtils.equals($fields(), o.$fields())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
@ -8231,6 +8231,74 @@ public final class QOM {
|
||||
@NotNull Product $distinct(boolean distinct);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>RANK</code> function.
|
||||
* <p>
|
||||
* The <code>RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
public /*sealed*/ interface RankAgg
|
||||
extends
|
||||
QueryPart,
|
||||
org.jooq.OrderedAggregateFunction<Integer>
|
||||
//permits
|
||||
// RankAgg
|
||||
{
|
||||
@NotNull UnmodifiableList<? extends Field<?>> $fields();
|
||||
@CheckReturnValue
|
||||
@NotNull RankAgg $fields(Collection<? extends Field<?>> fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>DENSE RANK</code> function.
|
||||
* <p>
|
||||
* The <code>DENSE_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
public /*sealed*/ interface DenseRankAgg
|
||||
extends
|
||||
QueryPart,
|
||||
org.jooq.OrderedAggregateFunction<Integer>
|
||||
//permits
|
||||
// DenseRankAgg
|
||||
{
|
||||
@NotNull UnmodifiableList<? extends Field<?>> $fields();
|
||||
@CheckReturnValue
|
||||
@NotNull DenseRankAgg $fields(Collection<? extends Field<?>> fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>PERCENT RANK</code> function.
|
||||
* <p>
|
||||
* The <code>PERCENT_RANK</code> hypothetical set aggregate function.
|
||||
*/
|
||||
public /*sealed*/ interface PercentRankAgg
|
||||
extends
|
||||
QueryPart,
|
||||
org.jooq.OrderedAggregateFunction<BigDecimal>
|
||||
//permits
|
||||
// PercentRankAgg
|
||||
{
|
||||
@NotNull UnmodifiableList<? extends Field<?>> $fields();
|
||||
@CheckReturnValue
|
||||
@NotNull PercentRankAgg $fields(Collection<? extends Field<?>> fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>CUME DIST</code> function.
|
||||
* <p>
|
||||
* The <code>CUME_DIST</code> hypothetical set aggregate function.
|
||||
*/
|
||||
public /*sealed*/ interface CumeDistAgg
|
||||
extends
|
||||
QueryPart,
|
||||
org.jooq.OrderedAggregateFunction<BigDecimal>
|
||||
//permits
|
||||
// CumeDistAgg
|
||||
{
|
||||
@NotNull UnmodifiableList<? extends Field<?>> $fields();
|
||||
@CheckReturnValue
|
||||
@NotNull CumeDistAgg $fields(Collection<? extends Field<?>> fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>PERCENTILE CONT</code> function.
|
||||
* <p>
|
||||
|
||||
156
jOOQ/src/main/java/org/jooq/impl/RankAgg.java
Normal file
156
jOOQ/src/main/java/org/jooq/impl/RankAgg.java
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Other licenses:
|
||||
* -----------------------------------------------------------------------------
|
||||
* Commercial licenses for this work are available. These replace the above
|
||||
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
|
||||
* database integrations.
|
||||
*
|
||||
* For more information, please visit: https://www.jooq.org/legal/licensing
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.impl.DSL.*;
|
||||
import static org.jooq.impl.Internal.*;
|
||||
import static org.jooq.impl.Keywords.*;
|
||||
import static org.jooq.impl.Names.*;
|
||||
import static org.jooq.impl.SQLDataType.*;
|
||||
import static org.jooq.impl.Tools.*;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.*;
|
||||
import static org.jooq.impl.Tools.ExtendedDataKey.*;
|
||||
import static org.jooq.impl.Tools.SimpleDataKey.*;
|
||||
import static org.jooq.SQLDialect.*;
|
||||
|
||||
import org.jooq.*;
|
||||
import org.jooq.Function1;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The <code>RANK</code> statement.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
final class RankAgg
|
||||
extends
|
||||
AbstractAggregateFunction<Integer>
|
||||
implements
|
||||
QOM.RankAgg
|
||||
{
|
||||
|
||||
RankAgg(
|
||||
Collection<? extends Field<?>> fields
|
||||
) {
|
||||
super(
|
||||
false,
|
||||
N_RANK,
|
||||
INTEGER,
|
||||
fields
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: QueryPart API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public final void accept(Context<?> ctx) {
|
||||
super.accept(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final QOM.UnmodifiableList<? extends Field<?>> $fields() {
|
||||
return QOM.unmodifiable(getArguments());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final QOM.RankAgg $fields(Collection<? extends Field<?>> newValue) {
|
||||
return $constructor().apply(newValue);
|
||||
}
|
||||
|
||||
public final Function1<? super Collection<? extends Field<?>>, ? extends QOM.RankAgg> $constructor() {
|
||||
return (a1) -> new RankAgg((Collection<? extends Field<?>>) a1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (that instanceof QOM.RankAgg o) {
|
||||
return
|
||||
StringUtils.equals($fields(), o.$fields())
|
||||
;
|
||||
}
|
||||
else
|
||||
return super.equals(that);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user