This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch kylin5 in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/kylin5 by this push: new 1fa73daee7 KYLIN-5279 Add default null collation configuration with CalciteExtrasProperties for Kylin5.0 (#2001) 1fa73daee7 is described below commit 1fa73daee7fff8e912bcff9aaf859b66f5ebf94a Author: zznlime <68555081+zznl...@users.noreply.github.com> AuthorDate: Fri Nov 11 10:01:23 2022 +0800 KYLIN-5279 Add default null collation configuration with CalciteExtrasProperties for Kylin5.0 (#2001) * KYLIN-5279 Default null collation for Kylin5.0 sqls should be null-last for ASC order and null-first for DESC order. * KYLIN-5279 add a config for default null collation for Kylin5.0. * reuse KylinConfigBase#getCalciteExtrasProperties for get default null collation. --- .../org/apache/kylin/query/engine/KECalciteConfig.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/query-common/src/main/java/org/apache/kylin/query/engine/KECalciteConfig.java b/src/query-common/src/main/java/org/apache/kylin/query/engine/KECalciteConfig.java index 0ddd0d05b3..96f33ec9d1 100644 --- a/src/query-common/src/main/java/org/apache/kylin/query/engine/KECalciteConfig.java +++ b/src/query-common/src/main/java/org/apache/kylin/query/engine/KECalciteConfig.java @@ -53,7 +53,22 @@ public class KECalciteConfig extends CalciteConnectionConfigImpl { @Override public NullCollation defaultNullCollation() { - return NullCollation.LOW; + String nullCollation = kylinConfig.getCalciteExtrasProperties.get("defaultNullCollation"); + if (null == nullCollation) { + return NullCollation.HIGH; + } + switch (nullCollation.toLowerCase(Locale.ROOT)) { + case "low": + return NullCollation.LOW; + case "high": + return NullCollation.HIGH; + case "first": + return NullCollation.FIRST; + case "last": + return NullCollation.LAST; + default: + throw new UnsupportedOperationException("unsupported null collation type: " + nullCollation); + } } @Override