From 0844eb0c9b94617c92f7fe86c8c9e63c28101886 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 10 Mar 2020 17:46:36 +0100 Subject: [PATCH] [jOOQ/jOOQ#9927] Add support for JSON_ARRAYAGG - H2 support --- .../java/org/jooq/JSONArrayAggNullStep.java | 70 ++++++++++ .../org/jooq/JSONArrayAggOrderByStep.java | 71 ++++++++++ .../jooq/impl/AbstractAggregateFunction.java | 13 +- .../src/main/java/org/jooq/impl/ArrayAgg.java | 7 +- jOOQ/src/main/java/org/jooq/impl/Collect.java | 5 - jOOQ/src/main/java/org/jooq/impl/DSL.java | 18 +++ .../main/java/org/jooq/impl/JSONArrayAgg.java | 131 ++++++++++++++++++ .../java/org/jooq/impl/JSONNullClause.java | 42 ++++++ .../main/java/org/jooq/impl/JSONObject.java | 32 ++--- jOOQ/src/main/java/org/jooq/impl/ListAgg.java | 14 +- jOOQ/src/main/java/org/jooq/impl/Names.java | 3 + .../main/java/org/jooq/impl/ParserImpl.java | 13 +- 12 files changed, 370 insertions(+), 49 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/JSONArrayAggNullStep.java create mode 100644 jOOQ/src/main/java/org/jooq/JSONArrayAggOrderByStep.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/JSONArrayAgg.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/JSONNullClause.java diff --git a/jOOQ/src/main/java/org/jooq/JSONArrayAggNullStep.java b/jOOQ/src/main/java/org/jooq/JSONArrayAggNullStep.java new file mode 100644 index 0000000000..7b5518d478 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/JSONArrayAggNullStep.java @@ -0,0 +1,70 @@ +/* + * 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 + * + * http://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: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +// ... +// ... +import static org.jooq.SQLDialect.H2; +import static org.jooq.SQLDialect.MARIADB; +import static org.jooq.SQLDialect.MYSQL; +// ... +import static org.jooq.SQLDialect.POSTGRES; + +import org.jooq.impl.DSL; + +/** + * A step in the construction of {@link DSL#jsonObject(JSONEntry...)} or + * {@link DSL#jsonbObject(JSONEntry...)} functions where the NULL + * clause can be defined. + * + * @author Lukas Eder + */ +public interface JSONArrayAggNullStep extends AggregateFilterStep { + + /** + * Include NULL values in output JSON. + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + AggregateFilterStep nullOnNull(); + + /** + * Exclude NULL values in output JSON. + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + AggregateFilterStep absentOnNull(); +} diff --git a/jOOQ/src/main/java/org/jooq/JSONArrayAggOrderByStep.java b/jOOQ/src/main/java/org/jooq/JSONArrayAggOrderByStep.java new file mode 100644 index 0000000000..3c27ec2265 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/JSONArrayAggOrderByStep.java @@ -0,0 +1,71 @@ +/* + * 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 + * + * http://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: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +// ... +// ... +import static org.jooq.SQLDialect.H2; +import static org.jooq.SQLDialect.MARIADB; +import static org.jooq.SQLDialect.MYSQL; +// ... +import static org.jooq.SQLDialect.POSTGRES; + +import java.util.Collection; + +import org.jooq.impl.DSL; + +/** + * The SQL standard ARRAY_AGG() function. + * + * @author Lukas Eder + * @see DSL#arrayAgg(Field) + */ +public interface JSONArrayAggOrderByStep extends JSONArrayAggNullStep { + + /** + * Add an ORDER BY clause to the function. + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + JSONArrayAggNullStep orderBy(OrderField... fields); + + /** + * Add an ORDER BY clause to the function. + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + JSONArrayAggNullStep orderBy(Collection> fields); +} diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractAggregateFunction.java b/jOOQ/src/main/java/org/jooq/impl/AbstractAggregateFunction.java index e35bc5ffb6..5718ff6c65 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractAggregateFunction.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractAggregateFunction.java @@ -48,6 +48,7 @@ import static org.jooq.impl.DSL.condition; import static org.jooq.impl.DSL.one; import static org.jooq.impl.Keywords.K_DISTINCT; import static org.jooq.impl.Keywords.K_FILTER; +import static org.jooq.impl.Keywords.K_ORDER_BY; import static org.jooq.impl.Keywords.K_WHERE; import java.util.Arrays; @@ -160,6 +161,12 @@ implements .sql(')'); } + final void acceptOrderBy(Context ctx) { + if (!Tools.isEmpty(withinGroupOrderBy)) + ctx.sql(' ').visit(K_ORDER_BY).sql(' ') + .visit(withinGroupOrderBy); + } + // ------------------------------------------------------------------------- // XXX Aggregate function API // ------------------------------------------------------------------------- @@ -268,9 +275,9 @@ implements @Override - public final AbstractAggregateFunction orderBy(OrderField... fields) { + public /* non-final */ AbstractAggregateFunction orderBy(OrderField... fields) { if (windowSpecification != null) - windowSpecification.orderBy(fields); + super.orderBy(fields); else withinGroupOrderBy(fields); @@ -278,7 +285,7 @@ implements } @Override - public final AbstractAggregateFunction orderBy(Collection> fields) { + public /* non-final */ AbstractAggregateFunction orderBy(Collection> fields) { if (windowSpecification != null) windowSpecification.orderBy(fields); else diff --git a/jOOQ/src/main/java/org/jooq/impl/ArrayAgg.java b/jOOQ/src/main/java/org/jooq/impl/ArrayAgg.java index 9f35547680..8382d3e7c2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ArrayAgg.java +++ b/jOOQ/src/main/java/org/jooq/impl/ArrayAgg.java @@ -37,7 +37,6 @@ */ package org.jooq.impl; -import static org.jooq.impl.Keywords.K_ORDER_BY; import static org.jooq.impl.Names.N_ARRAY_AGG; import java.util.Arrays; @@ -63,11 +62,7 @@ final class ArrayAgg extends DefaultAggregateFunction { public final void accept(Context ctx) { ctx.visit(N_ARRAY_AGG).sql('('); acceptArguments1(ctx, new QueryPartList<>(Arrays.asList(arguments.get(0)))); - - if (!Tools.isEmpty(withinGroupOrderBy)) - ctx.sql(' ').visit(K_ORDER_BY).sql(' ') - .visit(withinGroupOrderBy); - + acceptOrderBy(ctx); ctx.sql(')'); acceptFilterClause(ctx); diff --git a/jOOQ/src/main/java/org/jooq/impl/Collect.java b/jOOQ/src/main/java/org/jooq/impl/Collect.java index cba147283f..bbac169a49 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Collect.java +++ b/jOOQ/src/main/java/org/jooq/impl/Collect.java @@ -81,11 +81,6 @@ package org.jooq.impl; - - - - - diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index f43c98aaa7..9ebb45626d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -59,6 +59,7 @@ import static org.jooq.SQLDialect.HSQLDB; import static org.jooq.SQLDialect.MARIADB; // ... // ... +// ... import static org.jooq.SQLDialect.MYSQL; // ... // ... @@ -231,6 +232,7 @@ import org.jooq.InsertValuesStep8; import org.jooq.InsertValuesStep9; import org.jooq.InsertValuesStepN; import org.jooq.JSON; +import org.jooq.JSONArrayAggOrderByStep; import org.jooq.JSONB; import org.jooq.JSONEntry; import org.jooq.JSONObjectNullStep; @@ -18191,6 +18193,22 @@ public class DSL { return new JSONObject<>(JSONB, entries); } + /** + * The JSON array aggregate function + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + public static JSONArrayAggOrderByStep jsonArrayAgg(Field value) { + return new JSONArrayAgg(JSON, value); + } + + /** + * The JSON array aggregate function + */ + @Support({ H2, MARIADB, MYSQL, POSTGRES }) + public static JSONArrayAggOrderByStep jsonbArrayAgg(Field value) { + return new JSONArrayAgg(JSONB, value); + } + // ------------------------------------------------------------------------- // XXX Aggregate functions // ------------------------------------------------------------------------- diff --git a/jOOQ/src/main/java/org/jooq/impl/JSONArrayAgg.java b/jOOQ/src/main/java/org/jooq/impl/JSONArrayAgg.java new file mode 100644 index 0000000000..be6aad838b --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/JSONArrayAgg.java @@ -0,0 +1,131 @@ +/* + * 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 + * + * http://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: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +import static org.jooq.impl.DSL.unquotedName; +import static org.jooq.impl.JSONNullClause.ABSENT_ON_NULL; +import static org.jooq.impl.JSONNullClause.NULL_ON_NULL; +import static org.jooq.impl.JSONObject.acceptJSONNullClause; +import static org.jooq.impl.Names.N_JSONB_AGG; +import static org.jooq.impl.Names.N_JSON_AGG; +import static org.jooq.impl.Names.N_JSON_ARRAYAGG; +import static org.jooq.impl.SQLDataType.JSON; + +import java.util.Collection; + +import org.jooq.Context; +import org.jooq.DataType; +import org.jooq.Field; +import org.jooq.JSONArrayAggOrderByStep; +import org.jooq.OrderField; + + +/** + * The JSON array constructor. + * + * @author Lukas Eder + */ +final class JSONArrayAgg +extends AbstractAggregateFunction +implements JSONArrayAggOrderByStep { + + /** + * Generated UID + */ + private static final long serialVersionUID = 1772007627336725780L; + + private JSONNullClause nullClause; + + JSONArrayAgg(DataType type, Field arg) { + super(false, N_JSON_ARRAYAGG, type, arg); + } + + @Override + public void accept(Context ctx) { + switch (ctx.family()) { + + + + + + case POSTGRES: + if (nullClause == ABSENT_ON_NULL) + ctx.visit(unquotedName("json_strip_nulls")).sql('('); + + ctx.visit(getDataType() == JSON ? N_JSON_AGG : N_JSONB_AGG).sql('('); + ctx.visit(arguments.get(0)); + acceptOrderBy(ctx); + ctx.sql(')'); + + if (nullClause == ABSENT_ON_NULL) + ctx.sql(')'); + + break; + + default: + ctx.visit(N_JSON_ARRAYAGG).sql('('); + ctx.visit(arguments.get(0)); + acceptOrderBy(ctx); + acceptJSONNullClause(ctx, nullClause); + ctx.sql(')'); + break; + } + } + + @Override + public final JSONArrayAgg nullOnNull() { + nullClause = NULL_ON_NULL; + return this; + } + + @Override + public final JSONArrayAgg absentOnNull() { + nullClause = ABSENT_ON_NULL; + return this; + } + + @Override + public final JSONArrayAgg orderBy(OrderField... fields) { + return (JSONArrayAgg) super.orderBy(fields); + } + + @Override + public final JSONArrayAgg orderBy(Collection> fields) { + return (JSONArrayAgg) super.orderBy(fields); + } +} diff --git a/jOOQ/src/main/java/org/jooq/impl/JSONNullClause.java b/jOOQ/src/main/java/org/jooq/impl/JSONNullClause.java new file mode 100644 index 0000000000..e14e0b2df0 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/JSONNullClause.java @@ -0,0 +1,42 @@ +/* + * 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 + * + * http://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: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + +enum JSONNullClause { + NULL_ON_NULL, ABSENT_ON_NULL +} \ No newline at end of file diff --git a/jOOQ/src/main/java/org/jooq/impl/JSONObject.java b/jOOQ/src/main/java/org/jooq/impl/JSONObject.java index e0a1c63540..f5ef0d7885 100644 --- a/jOOQ/src/main/java/org/jooq/impl/JSONObject.java +++ b/jOOQ/src/main/java/org/jooq/impl/JSONObject.java @@ -47,8 +47,8 @@ import static org.jooq.impl.DSL.row; import static org.jooq.impl.DSL.select; import static org.jooq.impl.DSL.unquotedName; import static org.jooq.impl.DSL.values; -import static org.jooq.impl.JSONObject.NullClause.ABSENT_ON_NULL; -import static org.jooq.impl.JSONObject.NullClause.NULL_ON_NULL; +import static org.jooq.impl.JSONNullClause.ABSENT_ON_NULL; +import static org.jooq.impl.JSONNullClause.NULL_ON_NULL; import static org.jooq.impl.Keywords.K_ABSENT; import static org.jooq.impl.Keywords.K_JSON_OBJECT; import static org.jooq.impl.Keywords.K_NULL; @@ -83,13 +83,13 @@ final class JSONObject extends AbstractField implements JSONObjectNullStep static final Set NO_SUPPORT_ABSENT_ON_NULL = SQLDialect.supportedBy(MARIADB, MYSQL); private final QueryPartList> args; - private final NullClause nullClause; + private final JSONNullClause nullClause; JSONObject(DataType type, Collection> args) { this(type, args, null); } - JSONObject(DataType type, Collection> args, NullClause nullClause) { + JSONObject(DataType type, Collection> args, JSONNullClause nullClause) { super(N_JSON_OBJECT, type); this.args = new QueryPartList<>(args); @@ -110,16 +110,12 @@ final class JSONObject extends AbstractField implements JSONObjectNullStep return new JSONObject<>(getDataType(), args, ABSENT_ON_NULL); } - enum NullClause { - NULL_ON_NULL, ABSENT_ON_NULL - } - // ------------------------------------------------------------------------- // XXX: QueryPart API // ------------------------------------------------------------------------- @Override - public void accept(Context ctx) { + public final void accept(Context ctx) { switch (ctx.family()) { @@ -127,12 +123,12 @@ final class JSONObject extends AbstractField implements JSONObjectNullStep case POSTGRES: - if (nullClause == NullClause.ABSENT_ON_NULL) + if (nullClause == ABSENT_ON_NULL) ctx.visit(unquotedName("json_strip_nulls")).sql('('); ctx.visit(unquotedName("json_build_object")).sql('(').visit(args).sql(')'); - if (nullClause == NullClause.ABSENT_ON_NULL) + if (nullClause == ABSENT_ON_NULL) ctx.sql(')'); break; @@ -190,14 +186,18 @@ final class JSONObject extends AbstractField implements JSONObjectNullStep - - else if (nullClause == NULL_ON_NULL) - ctx.sql(' ').visit(K_NULL).sql(' ').visit(K_ON).sql(' ').visit(K_NULL); - else if (nullClause == ABSENT_ON_NULL) - ctx.sql(' ').visit(K_ABSENT).sql(' ').visit(K_ON).sql(' ').visit(K_NULL); + else + acceptJSONNullClause(ctx, nullClause); ctx.sql(')'); break; } } + + static final void acceptJSONNullClause(Context ctx, JSONNullClause nullClause) { + if (nullClause == NULL_ON_NULL) + ctx.sql(' ').visit(K_NULL).sql(' ').visit(K_ON).sql(' ').visit(K_NULL); + else if (nullClause == ABSENT_ON_NULL) + ctx.sql(' ').visit(K_ABSENT).sql(' ').visit(K_ON).sql(' ').visit(K_NULL); + } } diff --git a/jOOQ/src/main/java/org/jooq/impl/ListAgg.java b/jOOQ/src/main/java/org/jooq/impl/ListAgg.java index f33388d6b0..f8c8108b07 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ListAgg.java +++ b/jOOQ/src/main/java/org/jooq/impl/ListAgg.java @@ -58,7 +58,6 @@ import static org.jooq.impl.Keywords.F_XMLSERIALIZE; import static org.jooq.impl.Keywords.F_XMLTEXT; import static org.jooq.impl.Keywords.K_AS; import static org.jooq.impl.Keywords.K_DISTINCT; -import static org.jooq.impl.Keywords.K_ORDER_BY; import static org.jooq.impl.Keywords.K_SEPARATOR; import static org.jooq.impl.Names.N_GROUP_CONCAT; import static org.jooq.impl.Names.N_LIST; @@ -129,10 +128,7 @@ final class ListAgg extends DefaultAggregateFunction { private final void acceptGroupConcat(Context ctx) { ctx.visit(N_GROUP_CONCAT).sql('('); acceptArguments1(ctx, new QueryPartList<>(Arrays.asList(arguments.get(0)))); - - if (!Tools.isEmpty(withinGroupOrderBy)) - ctx.sql(' ').visit(K_ORDER_BY).sql(' ') - .visit(withinGroupOrderBy); + acceptOrderBy(ctx); if (arguments.size() > 1) if (ctx.family() == SQLITE) @@ -173,10 +169,7 @@ final class ListAgg extends DefaultAggregateFunction { else ctx.sql(", ''"); - if (!Tools.isEmpty(withinGroupOrderBy)) - ctx.sql(' ').visit(K_ORDER_BY).sql(' ') - .visit(withinGroupOrderBy); - + acceptOrderBy(ctx); ctx.sql(')'); } @@ -221,9 +214,6 @@ final class ListAgg extends DefaultAggregateFunction { - - - diff --git a/jOOQ/src/main/java/org/jooq/impl/Names.java b/jOOQ/src/main/java/org/jooq/impl/Names.java index 0cdf8908b3..71645d0d4a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -84,8 +84,11 @@ final class Names { static final Name N_GROUP_CONCAT = DSL.unquotedName("group_concat"); static final Name N_IIF = DSL.unquotedName("iif"); static final Name N_JOIN = DSL.unquotedName("join"); + static final Name N_JSON_AGG = DSL.unquotedName("json_agg"); static final Name N_JSON_ARRAY = DSL.unquotedName("json_array"); + static final Name N_JSON_ARRAYAGG = DSL.unquotedName("json_arrayagg"); static final Name N_JSON_OBJECT = DSL.unquotedName("json_object"); + static final Name N_JSONB_AGG = DSL.unquotedName("jsonb_agg"); static final Name N_LEFT = DSL.unquotedName("left"); static final Name N_LIST = DSL.unquotedName("list"); static final Name N_LISTAGG = DSL.unquotedName("listagg"); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index dba8c299f4..3a9d977fe8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -504,7 +504,6 @@ import org.jooq.conf.RenderNameCase; import org.jooq.conf.RenderQuotedNames; import org.jooq.conf.Settings; import org.jooq.conf.SettingsTools; -import org.jooq.impl.JSONObject.NullClause; import org.jooq.tools.StringUtils; import org.jooq.tools.reflect.Reflect; import org.jooq.types.DayToSecond; @@ -6682,7 +6681,7 @@ final class ParserImpl implements Parser { return DSL.jsonObject(); List> result = new ArrayList<>(); - NullClause nullClause = parseJSONObjectNullClauseIf(ctx); + JSONNullClause nullClause = parseJSONObjectNullClauseIf(ctx); if (nullClause == null) { do { @@ -6695,9 +6694,9 @@ final class ParserImpl implements Parser { parse(ctx, ')'); JSONObjectNullStep o = DSL.jsonObject(result); - return nullClause == NullClause.NULL_ON_NULL + return nullClause == JSONNullClause.NULL_ON_NULL ? o.nullOnNull() - : nullClause == NullClause.ABSENT_ON_NULL + : nullClause == JSONNullClause.ABSENT_ON_NULL ? o.absentOnNull() : o; } @@ -6705,11 +6704,11 @@ final class ParserImpl implements Parser { return null; } - private static final NullClause parseJSONObjectNullClauseIf(ParserContext ctx) { + private static final JSONNullClause parseJSONObjectNullClauseIf(ParserContext ctx) { if (parseKeywordIf(ctx, "NULL ON NULL")) - return NullClause.NULL_ON_NULL; + return JSONNullClause.NULL_ON_NULL; else if (parseKeywordIf(ctx, "ABSENT ON NULL")) - return NullClause.ABSENT_ON_NULL; + return JSONNullClause.ABSENT_ON_NULL; else return null; }