From d2744be46a6172de4286d5ee0d2be1f024e59388 Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Mon, 2 Sep 2024 14:35:28 +0800 Subject: [PATCH 1/8] add fold constant by fe cases --- .../expressions/ExpressionEvaluator.java | 2 + .../executable/StringArithmetic.java | 54 ++++++ .../fold_constant/fold_constant_by_be.out | Bin 132 -> 13692 bytes .../fold_constant/fold_constant_by_be.groovy | 174 +++++++++++++++++- 4 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java index 566798ec2d4e46..505f0c0bbe64dc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java @@ -26,6 +26,7 @@ import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeExtractAndTransform; import org.apache.doris.nereids.trees.expressions.functions.executable.ExecutableFunctions; import org.apache.doris.nereids.trees.expressions.functions.executable.NumericArithmetic; +import org.apache.doris.nereids.trees.expressions.functions.executable.StringArithmetic; import org.apache.doris.nereids.trees.expressions.functions.executable.TimeRoundSeries; import org.apache.doris.nereids.trees.expressions.literal.DateLiteral; import org.apache.doris.nereids.trees.expressions.literal.Literal; @@ -143,6 +144,7 @@ private void registerFunctions() { DateLiteral.class, DateTimeArithmetic.class, NumericArithmetic.class, + StringArithmetic.class, TimeRoundSeries.class ); for (Class cls : classes) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java new file mode 100644 index 00000000000000..37ab3db5851b5b --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +package org.apache.doris.nereids.trees.expressions.functions.executable; + +import org.apache.doris.nereids.trees.expressions.ExecFunction; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; +import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; + +/** + * executable functions: + * concat + */ +public class StringArithmetic { + /** + * Executable arithmetic functions concat + */ + @ExecFunction(name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiteral second) { + String result = first.getValue() + second.getValue(); + return new VarcharLiteral(result); + } + + /** + * Executable arithmetic functions substring + */ + // substring constructor would add + @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { + String result = null; + if (third.getValue() > first.getValue().length()) { + result = first.getValue().substring(second.getValue()); + } else { + result = first.getValue().substring(second.getValue(), third.getValue()); + } + return new VarcharLiteral(result); + } + +} diff --git a/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out b/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out index c7c506292a5423bcb7458acc19ca75ed20782437..5a8af5458cf2413888994f4dafa496da46b556e0 100644 GIT binary patch literal 13692 zcmeI3-EN~s6vun*r#MWXEp!ns0)f z$EWOLde5?DdY{DX*LAvO+hvfmooI|#F0;ya4{el`;OKGwC@)pw$Fo#jP*{NZks*{o`9iR*MaZypzR z>G*@m&~b-9JB89Id))M<&Os~afH)Kw=m98Ip(59zk*g}Tw5uvAVgnknv@C0WOS9(d z;!qq+Fo%nQ>w4^iH*wGCm400uibEI9;h@Jr3&TO28K?~l^;4CQhpLGln1wjiQLc)o z@=z@LU=|gL!6&}irE5;LFdp@xXsF7|a1f<{>lP~9FA{Z%l`LH5!6wn7HY8fOfWhAI zPyz;9!>&m!#a$DZW4H@c6_ws#R*1p{4!3>h=k($hns8ymUEW`R{y{J9LKH4=xTVt+ z&5)J8tZ4M&uW7?!fV(+|Ui1zw_Zrx<9n4J*4er!PU%%AFp$c9DyEZ9Qm7o`gYS-Y3 zWg4nthE~w;huqS*zThUk{_w0~95S%)`ybh>th|q|gPo&vR4eHtdL{K#9;$wHxTmbK zpogL^4hI74F*RzJ6B;gHu)92zfZ?vPtfu`RqUBx_h^qj&zf6;aU(mx)$wCEhfPJRK zz7q?*;44|U;K7bFyGvI2JlxHrWw1GxPNWki1t;N2B)$H&!=Uo)ljW~S#X$nQ(JRTe zrR#6Y(+ncTbr89A>2?DncBl=QM) zp8S#d20K6L@SY4Aa2FVaQOpgba6gVyICy{bBbzy>#!T;rjgx+}>vh z0tI0Xg*qGxu>XsBl*W7>Wb;qKro1BTn&hqnzbFz12J8~~`ZJhtb+cOM$CAi~VRo%v zpWcP?SHLs9$YCLhjjSaV1*w?l7}sBtC>n~nuFba6!h#xq88yEaH5;D1o>CmK z)lhTH%^z2rnyu}l{u{+DJ*|f3@tf Date: Tue, 3 Sep 2024 16:21:32 +0800 Subject: [PATCH 2/8] add fold constant by fe string functions --- .../executable/StringArithmetic.java | 204 +++++++++++++++++- 1 file changed, 198 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 37ab3db5851b5b..8fc3ea12e529af 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -19,7 +19,10 @@ import org.apache.doris.nereids.trees.expressions.ExecFunction; import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.literal.ArrayLiteral; +import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; +import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; /** @@ -39,16 +42,205 @@ public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiter /** * Executable arithmetic functions substring */ - // substring constructor would add @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { - String result = null; - if (third.getValue() > first.getValue().length()) { - result = first.getValue().substring(second.getValue()); + int stringLength = first.getValue().length(); + if (stringLength == 0) { + return new VarcharLiteral(""); + } + int leftIndex = 0; + if (second.getValue() < (- stringLength)) { + return new VarcharLiteral(""); + } else if (second.getValue() < 0) { + leftIndex = stringLength + second.getValue(); + } else if (second.getValue() < stringLength) { + leftIndex = second.getValue(); } else { - result = first.getValue().substring(second.getValue(), third.getValue()); + return new VarcharLiteral(""); } - return new VarcharLiteral(result); + int rightIndex = 0; + if (third.getValue() < 0) { + return new VarcharLiteral(""); + } else if (third.getValue() > stringLength) { + rightIndex = stringLength; + } else { + rightIndex = third.getValue(); + } + return new VarcharLiteral(first.getValue().substring(leftIndex, rightIndex)); + } + + /** + * Executable arithmetic functions length + */ + @ExecFunction(name = "length", argTypes = {"VARCHAR"}, returnType = "INT") + public static Expression lengthVarchar(VarcharLiteral first) { + return new IntegerLiteral(first.getValue().length()); + } + + /** + * Executable arithmetic functions Lower + */ + @ExecFunction(name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression lowerVarchar(VarcharLiteral first) { + return new VarcharLiteral(first.getValue().toLowerCase()); + } + + /** + * Executable arithmetic functions Upper + */ + @ExecFunction(name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression upperVarchar(VarcharLiteral first) { + return new VarcharLiteral(first.getValue().toUpperCase()); + } + + /** + * Executable arithmetic functions Trim + */ + @ExecFunction(name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression trimVarchar(VarcharLiteral first) { + return new VarcharLiteral(first.getValue().strip()); + } + + /** + * Executable arithmetic functions LTrim + */ + @ExecFunction(name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression ltrimVarchar(VarcharLiteral first) { + return new VarcharLiteral(first.getValue().stripLeading()); + } + + /** + * Executable arithmetic functions RTrim + */ + @ExecFunction(name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression rtrimVarchar(VarcharLiteral first) { + return new VarcharLiteral(first.getValue().stripTrailing()); + } + + /** + * Executable arithmetic functions Replace + */ + @ExecFunction(name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression replace(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { + if (second.getValue().length() == 0) { + return new VarcharLiteral(first.getValue()); + } + return new VarcharLiteral(first.getValue().replace(second.getValue(), third.getValue())); + } + + /** + * Executable arithmetic functions Left + */ + @ExecFunction(name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression left(VarcharLiteral first, IntegerLiteral second) { + if (second.getValue() <= 0) { + return new VarcharLiteral(""); + } else if (second.getValue() < first.getValue().length()) { + return new VarcharLiteral(first.getValue().substring(0, second.getValue())); + } else { + return first; + } + } + + /** + * Executable arithmetic functions Right + */ + @ExecFunction(name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression right(VarcharLiteral first, IntegerLiteral second) { + if (second.getValue() <= 0) { + return new VarcharLiteral(""); + } else if (second.getValue() < first.getValue().length()) { + int length = first.getValue().length(); + return new VarcharLiteral(first.getValue().substring(length - second.getValue(), length)); + } else { + return first; + } + } + + /** + * Executable arithmetic functions Locate + */ + @ExecFunction(name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + public static Expression locate(VarcharLiteral first, VarcharLiteral second) { + return new IntegerLiteral(first.getValue().strip().indexOf(second.getValue())); + } + + /** + * Executable arithmetic functions Instr + */ + @ExecFunction(name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + public static Expression instr(VarcharLiteral first, VarcharLiteral second) { + return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); + } + + /** + * Executable arithmetic functions Ascii + */ + @ExecFunction(name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") + public static Expression ascii(VarcharLiteral first) { + if (first.getValue().length() == 0) { + return new IntegerLiteral(0); + } + char firstChar = first.getValue().charAt(0); + return new IntegerLiteral(firstChar); + } + + /** + * Executable arithmetic functions Bin + */ + @ExecFunction(name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") + public static Expression bin(BigIntLiteral first) { + return new VarcharLiteral(Long.toBinaryString(first.getValue())); + } + + /** + * Executable arithmetic functions Hex + */ + @ExecFunction(name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") + public static Expression hexBigInt(BigIntLiteral first) { + return new VarcharLiteral(Long.toHexString(first.getValue())); + } + + /** + * Executable arithmetic functions Hex + */ + @ExecFunction(name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression hexVarchar(VarcharLiteral first) { + return new VarcharLiteral(Long.toHexString(Long.valueOf(first.getValue()))); + } + + /** + * Executable arithmetic functions UnHex + */ + @ExecFunction(name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression unHexVarchar(VarcharLiteral first) { + return new VarcharLiteral(Long.toBinaryString(Long.valueOf(first.getValue()))); + } + + /** + * Executable arithmetic functions ConcatWs + */ + @ExecFunction(name = "concatws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") + public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral second) { + StringBuilder sb = new StringBuilder(); + for (Literal item : second.getValue()) { + sb.append(item.getStringValue()); + sb.append(first.getValue()); + } + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions ConcatWs + */ + @ExecFunction(name = "concatws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression concatWsVarcharVarchar(VarcharLiteral first, ArrayLiteral second) { + StringBuilder sb = new StringBuilder(); + for (Literal item : second.getValue()) { + sb.append(item.getStringValue()); + sb.append(first.getValue()); + } + return new VarcharLiteral(sb.toString()); } } From 0e365bf459d16dd57dee0a5a3f81e387d37dc314 Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Wed, 4 Sep 2024 22:29:26 +0800 Subject: [PATCH 3/8] add varargs of string functions --- .../trees/expressions/ExecFunction.java | 5 + .../expressions/ExpressionEvaluator.java | 66 +++- .../functions/executable/DateTimeAcquire.java | 24 +- .../executable/DateTimeArithmetic.java | 122 ++++---- .../DateTimeExtractAndTransform.java | 276 ++++++++--------- .../executable/ExecutableFunctions.java | 26 +- .../executable/NumericArithmetic.java | 174 +++++------ .../executable/StringArithmetic.java | 252 +++++++++++++-- .../functions/executable/TimeRoundSeries.java | 288 +++++++++--------- 9 files changed, 744 insertions(+), 489 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java index 6778c0971edcbd..6aa5f800268b8c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java @@ -43,4 +43,9 @@ * return type */ String returnType(); + + /** + * hasVarArgsc + */ + boolean hasVarArgs(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java index 505f0c0bbe64dc..f513eff9de5b33 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.expressions; import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.Type; import org.apache.doris.common.AnalysisException; import org.apache.doris.nereids.trees.expressions.functions.BoundFunction; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; @@ -31,12 +32,14 @@ import org.apache.doris.nereids.trees.expressions.literal.DateLiteral; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; +import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; import org.apache.doris.nereids.types.DataType; import org.apache.doris.nereids.util.TypeCoercionUtils; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMultimap; +import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -97,10 +100,28 @@ public Expression eval(Expression expression) { } private Expression invoke(Expression expression, String fnName, DataType[] args) { - FunctionSignature signature = new FunctionSignature(fnName, args, null); + FunctionSignature signature = new FunctionSignature(fnName, args, null, false); FunctionInvoker invoker = getFunction(signature); if (invoker != null) { try { + if (invoker.getSignature().hasVarArgs()) { + int fixedArgsSize = invoker.getSignature().getArgTypes().length - 1; + int totalSize = expression.children().size(); + Class[] parameterTypes = invoker.getMethod().getParameterTypes(); + Class parameterType = parameterTypes[parameterTypes.length - 1]; + Class componentType = parameterType.getComponentType(); + Object varArgs = Array.newInstance(componentType, totalSize - fixedArgsSize); + for (int i = fixedArgsSize; i < totalSize; i++) { + Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); + } + Object[] objects = new Object[fixedArgsSize + 1]; + for (int i = 0; i < fixedArgsSize; i++) { + objects[i] = expression.children().get(i); + } + objects[fixedArgsSize] = varArgs; + + return invoker.invokeVars(objects); + } return invoker.invoke(expression.children()); } catch (AnalysisException e) { return expression; @@ -115,9 +136,34 @@ private FunctionInvoker getFunction(FunctionSignature signature) { DataType[] candidateTypes = candidate.getSignature().getArgTypes(); DataType[] expectedTypes = signature.getArgTypes(); + if (candidate.getSignature().hasVarArgs()) { + if (candidateTypes.length > expectedTypes.length) { + continue; + } + boolean match = true; + for (int i = 0; i < candidateTypes.length - 1; i++) { + if (!(expectedTypes[i].toCatalogDataType().matchesType(candidateTypes[i].toCatalogDataType()))) { + match = false; + break; + } + } + Type varType = candidateTypes[candidateTypes.length - 1].toCatalogDataType(); + for (int i = candidateTypes.length - 1; i < expectedTypes.length; i++) { + if (!(expectedTypes[i].toCatalogDataType().matchesType(varType))) { + match = false; + break; + } + } + if (match) { + return candidate; + } else { + continue; + } + } if (candidateTypes.length != expectedTypes.length) { continue; } + boolean match = true; for (int i = 0; i < candidateTypes.length; i++) { if (!(expectedTypes[i].toCatalogDataType().matchesType(candidateTypes[i].toCatalogDataType()))) { @@ -174,7 +220,7 @@ private void registerFEFunction(ImmutableMultimap.Builder args) throws AnalysisException { throw new AnalysisException(e.getLocalizedMessage()); } } + + public Literal invokeVars(Object[] args) throws AnalysisException { + try { + return (Literal) method.invoke(null, args); + } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { + throw new AnalysisException(e.getLocalizedMessage()); + } + } } /** @@ -215,11 +269,13 @@ public static class FunctionSignature { private final String name; private final DataType[] argTypes; private final DataType returnType; + private final boolean hasVarArgs; - public FunctionSignature(String name, DataType[] argTypes, DataType returnType) { + public FunctionSignature(String name, DataType[] argTypes, DataType returnType, boolean hasVarArgs) { this.name = name; this.argTypes = argTypes; this.returnType = returnType; + this.hasVarArgs = hasVarArgs; } public DataType[] getArgTypes() { @@ -233,6 +289,10 @@ public DataType getReturnType() { public String getName() { return name; } + + public boolean hasVarArgs() { + return hasVarArgs; + } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java index 17403bd83c0770..9064b749b4c0d7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java @@ -36,12 +36,12 @@ public class DateTimeAcquire { /** * date acquire function: now */ - @ExecFunction(name = "now", argTypes = {}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "now", argTypes = {}, returnType = "DATETIME") public static Expression now() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "now", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "now", argTypes = {"INT"}, returnType = "DATETIMEV2") public static Expression now(IntegerLiteral precision) { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone()), precision.getValue()); @@ -50,12 +50,12 @@ public static Expression now(IntegerLiteral precision) { /** * date acquire function: current_timestamp */ - @ExecFunction(name = "current_timestamp", argTypes = {}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "current_timestamp", argTypes = {}, returnType = "DATETIME") public static Expression currentTimestamp() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "current_timestamp", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "current_timestamp", argTypes = {"INT"}, returnType = "DATETIMEV2") public static Expression currentTimestamp(IntegerLiteral precision) { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone()), precision.getValue()); } @@ -63,12 +63,12 @@ public static Expression currentTimestamp(IntegerLiteral precision) { /** * date acquire function: localtime/localtimestamp */ - @ExecFunction(name = "localtime", argTypes = {}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "localtime", argTypes = {}, returnType = "DATETIME") public static Expression localTime() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "localtimestamp", argTypes = {}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "localtimestamp", argTypes = {}, returnType = "DATETIME") public static Expression localTimestamp() { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } @@ -76,12 +76,12 @@ public static Expression localTimestamp() { /** * date acquire function: current_date */ - @ExecFunction(name = "curdate", argTypes = {}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "curdate", argTypes = {}, returnType = "DATE") public static Expression curDate() { return DateLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "current_date", argTypes = {}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "current_date", argTypes = {}, returnType = "DATE") public static Expression currentDate() { return DateLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } @@ -90,12 +90,12 @@ public static Expression currentDate() { // /** // * date acquire function: current_time // */ - // @ExecFunction(name = "curtime", argTypes = {}, returnType = "TIME") + // @ExecFunction(hasVarArgs = false, name = "curtime", argTypes = {}, returnType = "TIME") // public static Expression curTime() { // return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); // } - // @ExecFunction(name = "current_time", argTypes = {}, returnType = "TIME") + // @ExecFunction(hasVarArgs = false, name = "current_time", argTypes = {}, returnType = "TIME") // public static Expression currentTime() { // return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); // } @@ -103,7 +103,7 @@ public static Expression currentDate() { /** * date transformation function: unix_timestamp */ - @ExecFunction(name = "unix_timestamp", argTypes = {}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {}, returnType = "INT") public static Expression unixTimestamp() { return new IntegerLiteral((int) (System.currentTimeMillis() / 1000L)); } @@ -111,7 +111,7 @@ public static Expression unixTimestamp() { /** * date transformation function: utc_timestamp */ - @ExecFunction(name = "utc_timestamp", argTypes = {}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "utc_timestamp", argTypes = {}, returnType = "INT") public static Expression utcTimestamp() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(ZoneId.of("UTC+0"))); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java index c10181a1040db4..d4323af5d78d68 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java @@ -36,22 +36,22 @@ public class DateTimeArithmetic { /** * datetime arithmetic function date-add. */ - @ExecFunction(name = "date_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "date_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression dateAdd(DateLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "date_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dateAdd(DateTimeLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "date_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dateAdd(DateV2Literal date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "date_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dateAdd(DateTimeV2Literal date, IntegerLiteral day) { return daysAdd(date, day); } @@ -59,22 +59,22 @@ public static Expression dateAdd(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function date-sub. */ - @ExecFunction(name = "date_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "date_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression dateSub(DateLiteral date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "date_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "date_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dateSub(DateTimeLiteral date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "date_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "date_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dateSub(DateV2Literal date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "date_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "date_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dateSub(DateTimeV2Literal date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } @@ -82,22 +82,22 @@ public static Expression dateSub(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function years-add. */ - @ExecFunction(name = "years_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "years_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression yearsAdd(DateLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "years_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearsAdd(DateTimeLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "years_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearsAdd(DateV2Literal date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "years_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearsAdd(DateTimeV2Literal date, IntegerLiteral year) { return date.plusYears(year.getValue()); } @@ -105,22 +105,22 @@ public static Expression yearsAdd(DateTimeV2Literal date, IntegerLiteral year) { /** * datetime arithmetic function months-add. */ - @ExecFunction(name = "months_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "months_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression monthsAdd(DateLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "months_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthsAdd(DateTimeLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "months_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthsAdd(DateV2Literal date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "months_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthsAdd(DateTimeV2Literal date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } @@ -128,22 +128,22 @@ public static Expression monthsAdd(DateTimeV2Literal date, IntegerLiteral month) /** * datetime arithmetic function weeks-add. */ - @ExecFunction(name = "weeks_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "weeks_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression weeksAdd(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "weeks_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression weeksAdd(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "weeks_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression weeksAdd(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "weeks_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression weeksAdd(DateTimeV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } @@ -151,22 +151,22 @@ public static Expression weeksAdd(DateTimeV2Literal date, IntegerLiteral weeks) /** * datetime arithmetic function days-add. */ - @ExecFunction(name = "days_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "days_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression daysAdd(DateLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "days_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression daysAdd(DateTimeLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "days_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression daysAdd(DateV2Literal date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "days_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression daysAdd(DateTimeV2Literal date, IntegerLiteral day) { return date.plusDays(day.getValue()); } @@ -174,12 +174,12 @@ public static Expression daysAdd(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function hours-add. */ - @ExecFunction(name = "hours_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hours_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hoursAdd(DateTimeLiteral date, IntegerLiteral hour) { return date.plusHours(hour.getValue()); } - @ExecFunction(name = "hours_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hours_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hoursAdd(DateTimeV2Literal date, IntegerLiteral hour) { return date.plusHours(hour.getValue()); } @@ -187,12 +187,12 @@ public static Expression hoursAdd(DateTimeV2Literal date, IntegerLiteral hour) { /** * datetime arithmetic function minutes-add. */ - @ExecFunction(name = "minutes_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minutes_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minutesAdd(DateTimeLiteral date, IntegerLiteral minute) { return date.plusMinutes(minute.getValue()); } - @ExecFunction(name = "minutes_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minutes_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minutesAdd(DateTimeV2Literal date, IntegerLiteral minute) { return date.plusMinutes(minute.getValue()); } @@ -200,12 +200,12 @@ public static Expression minutesAdd(DateTimeV2Literal date, IntegerLiteral minut /** * datetime arithmetic function seconds-add. */ - @ExecFunction(name = "seconds_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "seconds_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondsAdd(DateTimeLiteral date, IntegerLiteral second) { return date.plusSeconds(second.getValue()); } - @ExecFunction(name = "seconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "seconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondsAdd(DateTimeV2Literal date, IntegerLiteral second) { return date.plusSeconds(second.getValue()); } @@ -213,7 +213,7 @@ public static Expression secondsAdd(DateTimeV2Literal date, IntegerLiteral secon /** * datetime arithmetic function microseconds-add. */ - @ExecFunction(name = "microseconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "microseconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression microSecondsAdd(DateTimeV2Literal date, IntegerLiteral microSecond) { return date.plusMicroSeconds(microSecond.getValue()); } @@ -221,7 +221,7 @@ public static Expression microSecondsAdd(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function microseconds_sub. */ - @ExecFunction(name = "microseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "microseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression microSecondsSub(DateTimeV2Literal date, IntegerLiteral microSecond) { return date.plusMicroSeconds(-microSecond.getValue()); } @@ -229,7 +229,7 @@ public static Expression microSecondsSub(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function milliseconds_add. */ - @ExecFunction(name = "milliseconds_add", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "milliseconds_add", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression milliSecondsAdd(DateTimeV2Literal date, IntegerLiteral milliSecond) { return date.plusMilliSeconds(milliSecond.getValue()); } @@ -237,7 +237,7 @@ public static Expression milliSecondsAdd(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function milliseconds_sub. */ - @ExecFunction(name = "milliseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "milliseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression milliSecondsSub(DateTimeV2Literal date, IntegerLiteral milliSecond) { return date.plusMilliSeconds(-milliSecond.getValue()); } @@ -245,22 +245,22 @@ public static Expression milliSecondsSub(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function years-sub. */ - @ExecFunction(name = "years_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "years_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression yearsSub(DateLiteral date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(name = "years_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "years_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearsSub(DateTimeLiteral date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(name = "years_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "years_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearsSub(DateV2Literal date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(name = "years_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "years_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearsSub(DateTimeV2Literal date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } @@ -268,22 +268,22 @@ public static Expression yearsSub(DateTimeV2Literal date, IntegerLiteral year) { /** * datetime arithmetic function months-sub */ - @ExecFunction(name = "months_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "months_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression monthsSub(DateLiteral date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(name = "months_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "months_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthsSub(DateTimeLiteral date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(name = "months_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "months_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthsSub(DateV2Literal date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(name = "months_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "months_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthsSub(DateTimeV2Literal date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } @@ -291,22 +291,22 @@ public static Expression monthsSub(DateTimeV2Literal date, IntegerLiteral month) /** * datetime arithmetic function weeks-sub. */ - @ExecFunction(name = "weeks_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "weeks_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression weeksSub(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "weeks_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression weeksSub(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "weeks_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression weeksSub(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "weeks_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression weeksSub(DateTimeV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } @@ -314,22 +314,22 @@ public static Expression weeksSub(DateTimeV2Literal date, IntegerLiteral weeks) /** * datetime arithmetic function days-sub */ - @ExecFunction(name = "days_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "days_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression daysSub(DateLiteral date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "days_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "days_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression daysSub(DateTimeLiteral date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "days_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "days_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression daysSub(DateV2Literal date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(name = "days_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "days_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression daysSub(DateTimeV2Literal date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } @@ -337,12 +337,12 @@ public static Expression daysSub(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function hours-sub */ - @ExecFunction(name = "hours_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hours_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hoursSub(DateTimeLiteral date, IntegerLiteral hour) { return hoursAdd(date, new IntegerLiteral(-hour.getValue())); } - @ExecFunction(name = "hours_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hours_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hoursSub(DateTimeV2Literal date, IntegerLiteral hour) { return hoursAdd(date, new IntegerLiteral(-hour.getValue())); } @@ -350,12 +350,12 @@ public static Expression hoursSub(DateTimeV2Literal date, IntegerLiteral hour) { /** * datetime arithmetic function minutes-sub */ - @ExecFunction(name = "minutes_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minutes_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minutesSub(DateTimeLiteral date, IntegerLiteral minute) { return minutesAdd(date, new IntegerLiteral(-minute.getValue())); } - @ExecFunction(name = "minutes_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minutes_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minutesSub(DateTimeV2Literal date, IntegerLiteral minute) { return minutesAdd(date, new IntegerLiteral(-minute.getValue())); } @@ -363,12 +363,12 @@ public static Expression minutesSub(DateTimeV2Literal date, IntegerLiteral minut /** * datetime arithmetic function seconds-sub */ - @ExecFunction(name = "seconds_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "seconds_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondsSub(DateTimeLiteral date, IntegerLiteral second) { return secondsAdd(date, new IntegerLiteral(-second.getValue())); } - @ExecFunction(name = "seconds_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "seconds_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondsSub(DateTimeV2Literal date, IntegerLiteral second) { return secondsAdd(date, new IntegerLiteral(-second.getValue())); } @@ -376,27 +376,27 @@ public static Expression secondsSub(DateTimeV2Literal date, IntegerLiteral secon /** * datetime arithmetic function datediff */ - @ExecFunction(name = "datediff", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "datediff", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") public static Expression dateDiff(DateTimeLiteral date1, DateTimeLiteral date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(name = "datediff", argTypes = {"DATEV2", "DATEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "datediff", argTypes = {"DATEV2", "DATEV2"}, returnType = "INT") public static Expression dateDiff(DateV2Literal date1, DateV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(name = "datediff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "datediff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "INT") public static Expression dateDiff(DateV2Literal date1, DateTimeV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(name = "datediff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "datediff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "INT") public static Expression dateDiff(DateTimeV2Literal date1, DateV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(name = "datediff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "datediff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") public static Expression dateDiff(DateTimeV2Literal date1, DateTimeV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java index 9742602a07a249..06edebe821bc26 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java @@ -67,7 +67,7 @@ public class DateTimeExtractAndTransform { /** * datetime arithmetic function date-v2 */ - @ExecFunction(name = "datev2", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "datev2", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression dateV2(DateTimeV2Literal dateTime) { return new DateV2Literal(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } @@ -75,22 +75,22 @@ public static Expression dateV2(DateTimeV2Literal dateTime) { /** * Executable datetime extract year */ - @ExecFunction(name = "year", argTypes = {"DATE"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "year", argTypes = {"DATE"}, returnType = "SMALLINT") public static Expression year(DateLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "year", argTypes = {"DATETIME"}, returnType = "SMALLINT") public static Expression year(DateTimeLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "year", argTypes = {"DATEV2"}, returnType = "SMALLINT") public static Expression year(DateV2Literal date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "year", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") public static Expression year(DateTimeV2Literal date) { return new SmallIntLiteral(((short) date.getYear())); } @@ -98,22 +98,22 @@ public static Expression year(DateTimeV2Literal date) { /** * Executable datetime extract quarter */ - @ExecFunction(name = "quarter", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "quarter", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression quarter(DateLiteral date) { return new TinyIntLiteral((byte) (((byte) date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "quarter", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression quarter(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "quarter", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression quarter(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "quarter", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression quarter(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } @@ -121,22 +121,22 @@ public static Expression quarter(DateTimeV2Literal date) { /** * Executable datetime extract month */ - @ExecFunction(name = "month", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "month", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression month(DateLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "month", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression month(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "month", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression month(DateV2Literal date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "month", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression month(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.getMonth()); } @@ -144,22 +144,22 @@ public static Expression month(DateTimeV2Literal date) { /** * Executable datetime extract day */ - @ExecFunction(name = "day", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "day", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression day(DateLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "day", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression day(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "day", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression day(DateV2Literal date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "day", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression day(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.getDay()); } @@ -167,12 +167,12 @@ public static Expression day(DateTimeV2Literal date) { /** * Executable datetime extract hour */ - @ExecFunction(name = "hour", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "hour", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression hour(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getHour())); } - @ExecFunction(name = "hour", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "hour", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression hour(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getHour())); } @@ -180,12 +180,12 @@ public static Expression hour(DateTimeV2Literal date) { /** * Executable datetime extract hour */ - @ExecFunction(name = "minute", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "minute", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression minute(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getMinute())); } - @ExecFunction(name = "minute", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "minute", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression minute(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getMinute())); } @@ -193,12 +193,12 @@ public static Expression minute(DateTimeV2Literal date) { /** * Executable datetime extract second */ - @ExecFunction(name = "second", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "second", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression second(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getSecond())); } - @ExecFunction(name = "second", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "second", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression second(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getSecond())); } @@ -206,7 +206,7 @@ public static Expression second(DateTimeV2Literal date) { /** * Executable datetime extract microsecond */ - @ExecFunction(name = "microsecond", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "microsecond", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression microsecond(DateTimeV2Literal date) { return new IntegerLiteral(((int) date.getMicroSecond())); } @@ -214,22 +214,22 @@ public static Expression microsecond(DateTimeV2Literal date) { /** * Executable datetime extract dayofyear */ - @ExecFunction(name = "dayofyear", argTypes = {"DATE"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "dayofyear", argTypes = {"DATE"}, returnType = "SMALLINT") public static Expression dayOfYear(DateLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "dayofyear", argTypes = {"DATETIME"}, returnType = "SMALLINT") public static Expression dayOfYear(DateTimeLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "dayofyear", argTypes = {"DATEV2"}, returnType = "SMALLINT") public static Expression dayOfYear(DateV2Literal date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "dayofyear", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") public static Expression dayOfYear(DateTimeV2Literal date) { return new SmallIntLiteral((short) date.getDayOfYear()); } @@ -237,22 +237,22 @@ public static Expression dayOfYear(DateTimeV2Literal date) { /** * Executable datetime extract dayofmonth */ - @ExecFunction(name = "dayofmonth", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofmonth", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression dayOfMonth(DateLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofmonth", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression dayOfMonth(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofmonth", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression dayOfMonth(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofmonth", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression dayOfMonth(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } @@ -260,22 +260,22 @@ public static Expression dayOfMonth(DateTimeV2Literal date) { /** * Executable datetime extract dayofweek */ - @ExecFunction(name = "dayofweek", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofweek", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression dayOfWeek(DateLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofweek", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression dayOfWeek(DateTimeLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofweek", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression dayOfWeek(DateV2Literal date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "dayofweek", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression dayOfWeek(DateTimeV2Literal date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } @@ -291,26 +291,26 @@ private static LocalDateTime firstDayOfWeek(LocalDateTime dateTime) { /** * datetime arithmetic function date-format */ - @ExecFunction(name = "date_format", argTypes = {"DATE", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "date_format", argTypes = {"DATE", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateLiteral date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDate.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay())))); } - @ExecFunction(name = "date_format", argTypes = {"DATETIME", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "date_format", argTypes = {"DATETIME", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateTimeLiteral date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDateTime.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay()), ((int) date.getHour()), ((int) date.getMinute()), ((int) date.getSecond())))); } - @ExecFunction(name = "date_format", argTypes = {"DATEV2", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "date_format", argTypes = {"DATEV2", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateV2Literal date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDate.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay())))); } - @ExecFunction(name = "date_format", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "date_format", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateTimeV2Literal date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDateTime.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay()), @@ -320,12 +320,12 @@ public static Expression dateFormat(DateTimeV2Literal date, StringLikeLiteral fo /** * datetime arithmetic function date */ - @ExecFunction(name = "date", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "date", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression date(DateTimeLiteral dateTime) throws AnalysisException { return new DateLiteral(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } - @ExecFunction(name = "date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression date(DateTimeV2Literal dateTime) throws AnalysisException { return new DateV2Literal(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } @@ -333,22 +333,22 @@ public static Expression date(DateTimeV2Literal dateTime) throws AnalysisExcepti /** * datetime arithmetic function date-trunc */ - @ExecFunction(name = "date_trunc", argTypes = {"DATETIME", "VARCHAR"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "date_trunc", argTypes = {"DATETIME", "VARCHAR"}, returnType = "DATETIME") public static Expression dateTrunc(DateTimeLiteral date, StringLikeLiteral trunc) { return DateTimeLiteral.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(name = "date_trunc", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "date_trunc", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression dateTrunc(DateTimeV2Literal date, StringLikeLiteral trunc) { return DateTimeV2Literal.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(name = "date_trunc", argTypes = {"DATE", "VARCHAR"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "date_trunc", argTypes = {"DATE", "VARCHAR"}, returnType = "DATE") public static Expression dateTrunc(DateLiteral date, StringLikeLiteral trunc) { return DateLiteral.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(name = "date_trunc", argTypes = {"DATEV2", "VARCHAR"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "date_trunc", argTypes = {"DATEV2", "VARCHAR"}, returnType = "DATEV2") public static Expression dateTrunc(DateV2Literal date, StringLikeLiteral trunc) { return DateV2Literal.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } @@ -395,7 +395,7 @@ private static LocalDateTime dateTruncHelper(LocalDateTime dateTime, String trun /** * from_days. */ - @ExecFunction(name = "from_days", argTypes = {"INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "from_days", argTypes = {"INT"}, returnType = "DATEV2") public static Expression fromDays(IntegerLiteral n) { // doris treat 0000AD as ordinary year but java LocalDateTime treat it as lunar year. LocalDateTime res = LocalDateTime.of(0, 1, 1, 0, 0, 0) @@ -406,28 +406,28 @@ public static Expression fromDays(IntegerLiteral n) { return DateV2Literal.fromJavaDateType(res); } - @ExecFunction(name = "last_day", argTypes = {"DATE"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "last_day", argTypes = {"DATE"}, returnType = "DATE") public static Expression lastDay(DateLiteral date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateLiteral.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(name = "last_day", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "last_day", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression lastDay(DateTimeLiteral date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateLiteral.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(name = "last_day", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "last_day", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression lastDay(DateV2Literal date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateV2Literal.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(name = "last_day", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "last_day", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression lastDay(DateTimeV2Literal date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); @@ -437,22 +437,22 @@ public static Expression lastDay(DateTimeV2Literal date) { /** * datetime transformation function: to_monday */ - @ExecFunction(name = "to_monday", argTypes = {"DATE"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "to_monday", argTypes = {"DATE"}, returnType = "DATE") public static Expression toMonday(DateLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "to_monday", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression toMonday(DateTimeLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "to_monday", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression toMonday(DateV2Literal date) { return DateV2Literal.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "to_monday", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression toMonday(DateTimeV2Literal date) { return DateV2Literal.fromJavaDateType(toMonday(date.toJavaDateType())); } @@ -469,7 +469,7 @@ private static LocalDateTime toMonday(LocalDateTime dateTime) { /** * date transformation function: from_unixtime */ - @ExecFunction(name = "from_unixtime", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "from_unixtime", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression fromUnixTime(BigIntLiteral second) { return fromUnixTime(second, new VarcharLiteral("%Y-%m-%d %H:%i:%s")); } @@ -477,7 +477,7 @@ public static Expression fromUnixTime(BigIntLiteral second) { /** * date transformation function: from_unixtime */ - @ExecFunction(name = "from_unixtime", argTypes = {"BIGINT", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "from_unixtime", argTypes = {"BIGINT", "VARCHAR"}, returnType = "VARCHAR") public static Expression fromUnixTime(BigIntLiteral second, StringLikeLiteral format) { // 32536771199L is max valid timestamp of mysql from_unix_time if (second.getValue() < 0 || second.getValue() > 32536771199L) { @@ -497,17 +497,17 @@ public static Expression fromUnixTime(BigIntLiteral second, StringLikeLiteral fo /** * date transformation function: unix_timestamp */ - @ExecFunction(name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") public static Expression unixTimestamp(DateLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") public static Expression unixTimestamp(DateTimeLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") public static Expression unixTimestamp(DateV2Literal date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } @@ -515,7 +515,7 @@ public static Expression unixTimestamp(DateV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") public static Expression unixTimestamp(DateTimeV2Literal date) { if (date.getMicroSecond() == 0) { return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(10, 0), @@ -529,7 +529,7 @@ public static Expression unixTimestamp(DateTimeV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") public static Expression unixTimestamp(StringLikeLiteral date, StringLikeLiteral format) { DateTimeFormatter formatter = DateUtils.formatBuilder(format.getValue()).toFormatter(); LocalDateTime dateObj; @@ -564,12 +564,12 @@ private static String getTimestamp(LocalDateTime dateTime) { /** * date transformation function: to_date */ - @ExecFunction(name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression toDate(DateTimeLiteral date) { return new DateLiteral(date.getYear(), date.getMonth(), date.getDay()); } - @ExecFunction(name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression toDate(DateTimeV2Literal date) { return new DateV2Literal(date.getYear(), date.getMonth(), date.getDay()); } @@ -577,25 +577,25 @@ public static Expression toDate(DateTimeV2Literal date) { /** * date transformation function: to_days */ - @ExecFunction(name = "to_days", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATE"}, returnType = "INT") public static Expression toDays(DateLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") public static Expression toDays(DateTimeLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") public static Expression toDays(DateV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression toDays(DateTimeV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); @@ -604,7 +604,7 @@ public static Expression toDays(DateTimeV2Literal date) { /** * date transformation function: makedate */ - @ExecFunction(name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") + @ExecFunction(hasVarArgs = false, name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) { int day = dayOfYear.getValue(); return day > 0 ? DateLiteral.fromJavaDateType(LocalDateTime.of(year.getValue(), 1, 1, 0, 0, 0) @@ -614,7 +614,7 @@ public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) /** * date transformation function: str_to_date */ - @ExecFunction(name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral format) { if (org.apache.doris.analysis.DateLiteral.hasTimePart(format.getStringValue())) { DataType returnType = DataType.fromCatalogType(ScalarType.getDefaultDateType(Type.DATETIME)); @@ -637,12 +637,12 @@ public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral form } } - @ExecFunction(name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression timestamp(DateTimeLiteral datetime) { return datetime; } - @ExecFunction(name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression timestamp(DateTimeV2Literal datetime) { return datetime; } @@ -650,7 +650,7 @@ public static Expression timestamp(DateTimeV2Literal datetime) { /** * convert_tz */ - @ExecFunction(name = "convert_tz", argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "convert_tz", argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral fromTz, StringLikeLiteral toTz) { DateTimeFormatter zoneFormatter = new DateTimeFormatterBuilder() .parseCaseInsensitive() @@ -665,52 +665,52 @@ public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral return DateTimeV2Literal.fromJavaDateType(resultDateTime.toLocalDateTime(), datetime.getDataType().getScale()); } - @ExecFunction(name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression weekDay(DateLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekDay(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekDay(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekDay(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression week(DateV2Literal date) { return week(date.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateV2Literal date, IntegerLiteral mode) { return week(date.toJavaDateType(), mode.getIntValue()); } @@ -775,32 +775,32 @@ private static boolean isSpecificDate(LocalDateTime localDateTime) { && (localDateTime.getDayOfMonth() == 1 || localDateTime.getDayOfMonth() == 2); } - @ExecFunction(name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date, IntegerLiteral mode) { return yearWeek(date.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date) { return yearWeek(date.toJavaDateType(), 0); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } @@ -868,7 +868,7 @@ public static Expression yearWeek(LocalDateTime localDateTime, int mode) { /** * weekofyear */ - @ExecFunction(name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeV2Literal dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -883,7 +883,7 @@ public static Expression weekOfYear(DateTimeV2Literal dateTime) { /** * weekofyear */ - @ExecFunction(name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeLiteral dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -898,7 +898,7 @@ public static Expression weekOfYear(DateTimeLiteral dateTime) { /** * weekofyear */ - @ExecFunction(name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateV2Literal date) { if (date.getYear() == 0 && date.getDayOfWeek() == 1) { if (date.getMonth() == 1 && date.getDay() == 2) { @@ -909,53 +909,53 @@ public static Expression weekOfYear(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().get(WeekFields.ISO.weekOfWeekBasedYear())); } - @ExecFunction(name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression dayName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression dayName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression dayName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression monthName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression monthName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression monthName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromSecond(BigIntLiteral second) { return fromMicroSecond(second.getValue() * 1000 * 1000); } - @ExecFunction(name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMilliSecond(BigIntLiteral milliSecond) { return fromMicroSecond(milliSecond.getValue() * 1000); } - @ExecFunction(name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMicroSecond(BigIntLiteral microSecond) { return fromMicroSecond(microSecond.getValue()); } @@ -972,187 +972,187 @@ private static Expression fromMicroSecond(long microSecond) { dateTime.getMinute(), dateTime.getSecond(), dateTime.getNano() / 1000); } - @ExecFunction(name = "microseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "microseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression microsecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MICROS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "milliseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "milliseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression millisecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MILLIS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "seconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "minutes_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java index 42ad228ad722d7..c1feef1a6c0947 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java @@ -47,47 +47,47 @@ public class ExecutableFunctions { /** * other scalar function */ - @ExecFunction(name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") public static Expression abs(TinyIntLiteral literal) { return new SmallIntLiteral((short) Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") public static Expression abs(SmallIntLiteral literal) { return new IntegerLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"INT"}, returnType = "BIGINT") public static Expression abs(IntegerLiteral literal) { return new BigIntLiteral(Math.abs((long) literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") public static Expression abs(BigIntLiteral literal) { return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); } - @ExecFunction(name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") public static Expression abs(LargeIntLiteral literal) { return new LargeIntLiteral(literal.getValue().abs()); } - @ExecFunction(name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") public static Expression abs(FloatLiteral literal) { return new FloatLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression abs(DoubleLiteral literal) { return new DoubleLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") public static Expression abs(DecimalLiteral literal) { return new DecimalLiteral(literal.getValue().abs()); } - @ExecFunction(name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") public static Expression abs(DecimalV3Literal literal) { return new DecimalV3Literal(literal.getValue().abs()); } @@ -95,7 +95,7 @@ public static Expression abs(DecimalV3Literal literal) { /** * acos scalar function */ - @ExecFunction(name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression acos(DoubleLiteral literal) { double result = Math.acos(literal.getValue()); if (Double.isNaN(result)) { @@ -105,7 +105,7 @@ public static Expression acos(DoubleLiteral literal) { } } - @ExecFunction(name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, StringLikeLiteral chr) { if (literal.getValue().length() != 1) { return null; @@ -114,12 +114,12 @@ public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, S : new VarcharLiteral(literal.getValue() + chr.getValue()); } - @ExecFunction(name = "e", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "e", argTypes = {}, returnType = "DOUBLE") public static Expression e() { // CHECKSTYLE IGNORE THIS LINE return new DoubleLiteral(Math.E); } - @ExecFunction(name = "p1", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "p1", argTypes = {}, returnType = "DOUBLE") public static Expression pi() { return new DoubleLiteral(Math.PI); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java index 9477de8ed1a890..9a8c49a96a4ec5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java @@ -41,169 +41,169 @@ public class NumericArithmetic { /** * Executable arithmetic functions add */ - @ExecFunction(name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression addTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.addExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression addTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression addTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression addTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression addSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression addSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression addSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression addSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression addIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression addIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression addIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression addIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression addBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression addBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression addBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression addBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") public static Expression addLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") public static Expression addLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") public static Expression addLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") public static Expression addLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression addDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() + second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression addDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -212,169 +212,169 @@ public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3 /** * Executable arithmetic functions subtract */ - @ExecFunction(name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression subtractTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.subtractExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression subtractTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression subtractTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression subtractSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression subtractSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression subtractSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression subtractIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression subtractBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression subtractLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression subtractDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() - second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression subtractDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -383,163 +383,163 @@ public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions multiply */ - @ExecFunction(name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression multiplyTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.multiplyExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression multiplyTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression multiplyTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression multiplySmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression multiplySmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression multiplySmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplySmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplySmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression multiplyIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression multiplyBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression multiplyLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression multiplyDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() * second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().multiply(second.getValue()); return new DecimalLiteral(result); @@ -548,7 +548,7 @@ public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLit /** * decimalV3 multiply in FE */ - @ExecFunction(name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().multiply(second.getValue()); DecimalV3Type t1 = (DecimalV3Type) first.getDataType(); @@ -561,7 +561,7 @@ public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions divide */ - @ExecFunction(name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) { if (second.getValue() == 0.0) { return new NullLiteral(first.getDataType()); @@ -573,7 +573,7 @@ public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) /** * Executable arithmetic functions divide */ - @ExecFunction(name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral second) { if (first.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); @@ -585,7 +585,7 @@ public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral seco /** * decimalv3 divide in FE */ - @ExecFunction(name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Literal second) { if (second.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 8fc3ea12e529af..5c67bd6504bb5e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -17,13 +17,18 @@ package org.apache.doris.nereids.trees.expressions.functions.executable; +import org.apache.commons.codec.digest.DigestUtils; import org.apache.doris.nereids.trees.expressions.ExecFunction; import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.literal.ArrayLiteral; -import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; -import org.apache.doris.nereids.trees.expressions.literal.Literal; -import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; +import org.apache.doris.nereids.trees.expressions.literal.*; +import org.json.JSONObject; + +import javax.validation.constraints.Null; +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; /** * executable functions: @@ -33,7 +38,7 @@ public class StringArithmetic { /** * Executable arithmetic functions concat */ - @ExecFunction(name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiteral second) { String result = first.getValue() + second.getValue(); return new VarcharLiteral(result); @@ -42,7 +47,7 @@ public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiter /** * Executable arithmetic functions substring */ - @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { int stringLength = first.getValue().length(); if (stringLength == 0) { @@ -72,7 +77,7 @@ public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLit /** * Executable arithmetic functions length */ - @ExecFunction(name = "length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "length", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression lengthVarchar(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -80,7 +85,7 @@ public static Expression lengthVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Lower */ - @ExecFunction(name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression lowerVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toLowerCase()); } @@ -88,7 +93,7 @@ public static Expression lowerVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Upper */ - @ExecFunction(name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression upperVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toUpperCase()); } @@ -96,7 +101,7 @@ public static Expression upperVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Trim */ - @ExecFunction(name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression trimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().strip()); } @@ -104,7 +109,7 @@ public static Expression trimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions LTrim */ - @ExecFunction(name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression ltrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripLeading()); } @@ -112,7 +117,7 @@ public static Expression ltrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions RTrim */ - @ExecFunction(name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression rtrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripTrailing()); } @@ -120,7 +125,7 @@ public static Expression rtrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Replace */ - @ExecFunction(name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression replace(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { if (second.getValue().length() == 0) { return new VarcharLiteral(first.getValue()); @@ -131,7 +136,7 @@ public static Expression replace(VarcharLiteral first, VarcharLiteral second, Va /** * Executable arithmetic functions Left */ - @ExecFunction(name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression left(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -145,7 +150,7 @@ public static Expression left(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Right */ - @ExecFunction(name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression right(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -160,7 +165,7 @@ public static Expression right(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Locate */ - @ExecFunction(name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression locate(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(first.getValue().strip().indexOf(second.getValue())); } @@ -168,7 +173,7 @@ public static Expression locate(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Instr */ - @ExecFunction(name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression instr(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); } @@ -176,7 +181,7 @@ public static Expression instr(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Ascii */ - @ExecFunction(name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(hasVarArgs = false, name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression ascii(VarcharLiteral first) { if (first.getValue().length() == 0) { return new IntegerLiteral(0); @@ -188,7 +193,7 @@ public static Expression ascii(VarcharLiteral first) { /** * Executable arithmetic functions Bin */ - @ExecFunction(name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression bin(BigIntLiteral first) { return new VarcharLiteral(Long.toBinaryString(first.getValue())); } @@ -196,7 +201,7 @@ public static Expression bin(BigIntLiteral first) { /** * Executable arithmetic functions Hex */ - @ExecFunction(name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression hexBigInt(BigIntLiteral first) { return new VarcharLiteral(Long.toHexString(first.getValue())); } @@ -204,7 +209,7 @@ public static Expression hexBigInt(BigIntLiteral first) { /** * Executable arithmetic functions Hex */ - @ExecFunction(name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression hexVarchar(VarcharLiteral first) { return new VarcharLiteral(Long.toHexString(Long.valueOf(first.getValue()))); } @@ -212,7 +217,7 @@ public static Expression hexVarchar(VarcharLiteral first) { /** * Executable arithmetic functions UnHex */ - @ExecFunction(name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression unHexVarchar(VarcharLiteral first) { return new VarcharLiteral(Long.toBinaryString(Long.valueOf(first.getValue()))); } @@ -220,27 +225,212 @@ public static Expression unHexVarchar(VarcharLiteral first) { /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(name = "concatws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") + @ExecFunction(hasVarArgs = false, name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral second) { StringBuilder sb = new StringBuilder(); - for (Literal item : second.getValue()) { - sb.append(item.getStringValue()); - sb.append(first.getValue()); + for (int i = 0; i < second.getValue().size() - 1; i++) { + if (!(second.getValue().get(i) instanceof NullLiteral)) { + sb.append(second.getValue().get(i).getValue()); + sb.append(first.getValue()); + } } + sb.append(second.getValue().get(second.getValue().size() - 1).getValue()); return new VarcharLiteral(sb.toString()); } /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(name = "concatws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression concatWsVarcharVarchar(VarcharLiteral first, ArrayLiteral second) { + @ExecFunction(hasVarArgs = true, name = "concat_ws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLiteral... second) { StringBuilder sb = new StringBuilder(); - for (Literal item : second.getValue()) { - sb.append(item.getStringValue()); + for (int i = 0; i < second.length - 1; i++) { + sb.append(second[i].getValue()); sb.append(first.getValue()); } + sb.append(second[second.length - 1].getValue()); + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions Char + */ + @ExecFunction(hasVarArgs = true, name = "char", argTypes = {"STRING", "INT"}, returnType = "STRING") + public static Expression charStringInt(StringLiteral first, IntegerLiteral... second) { + StringBuilder sb = new StringBuilder(); + for (IntegerLiteral item : second) { + int itemValue = item.getValue(); + byte[] itemBytes = new byte[]{(byte) itemValue}; + try { + String itemString = new String(itemBytes, first.getValue()); + sb.append(itemString); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + return new StringLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions CharacterLength + */ + @ExecFunction(hasVarArgs = false, name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") + public static Expression characterLength(VarcharLiteral first) { + return new IntegerLiteral(first.getValue().length()); + } + + /** + * Executable arithmetic functions initCap + */ + @ExecFunction(hasVarArgs = false, name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression initCap(VarcharLiteral first) { + StringBuilder result = new StringBuilder(first.getValue().length()); + boolean capitalizeNext = true; + + for (char c : first.getValue().toCharArray()) { + if (Character.isWhitespace(c)) { + result.append(c); + capitalizeNext = true; // Next character should be capitalized + } else if (capitalizeNext) { + result.append(Character.toUpperCase(c)); + capitalizeNext = false; + } else { + result.append(Character.toLowerCase(c)); + } + } + return new VarcharLiteral(result.toString()); + } + + /** + * Executable arithmetic functions md5 + */ + @ExecFunction(hasVarArgs = false, name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression md5(VarcharLiteral first) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + // Update the digest with the input bytes + md.update(first.getValue().getBytes()); + return new VarcharLiteral(bytesToHex(md.digest())); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + /** + * Executable arithmetic functions md5 + */ + @ExecFunction(hasVarArgs = true, name = "md5sum", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression md5Sum(VarcharLiteral... first) { + try { + // Step 1: Create a MessageDigest instance for MD5 + MessageDigest md = MessageDigest.getInstance("MD5"); + + // Step 2: Concatenate all strings in the list into one string + StringBuilder combinedInput = new StringBuilder(); + for (VarcharLiteral input : first) { + combinedInput.append(input.getValue()); + } + + // Step 3: Convert the combined string to a byte array and pass it to the digest() method + byte[] messageDigest = md.digest(combinedInput.toString().getBytes()); + + // Step 4: Convert the byte array into a hexadecimal string + StringBuilder hexString = new StringBuilder(); + for (byte b : messageDigest) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + hexString.append('0'); // Add leading zero if needed + } + hexString.append(hex); + } + + // Step 5: Return the hexadecimal string + return new VarcharLiteral(hexString.toString()); + + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + // Helper method to convert a byte array to a hexadecimal string + private static String bytesToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(String.format("%02x", b)); + } + return sb.toString(); + } + + private static Object jsonExtractUnit(JSONObject jsonObject, String unitKey) { + String[] keys = unitKey.replace("$.", "").split("\\."); + Object currentObject = jsonObject; + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + + if (key.endsWith("]")) { // Handle array index access + int arrayStartIndex = key.indexOf('['); + String arrayKey = key.substring(0, arrayStartIndex); + int arrayIndex = Integer.parseInt(key.substring(arrayStartIndex + 1, key.length() - 1)); + + if (currentObject instanceof JSONObject) { + currentObject = ((JSONObject) currentObject).getJSONArray(arrayKey).get(arrayIndex); + } + } else { + if (currentObject instanceof JSONObject) { + currentObject = ((JSONObject) currentObject).get(key); + } + } + } + return currentObject; + } + private static List jsonExtract(String jsonString, String... jsonPaths) { + List extractedValues = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(jsonString); + + for (String jsonPath : jsonPaths) { + Object currentObject = jsonExtractUnit(jsonObject, jsonPath); + extractedValues.add(currentObject.toString()); + } + + return extractedValues; + } + + /** + * Executable arithmetic functions jsonContains + */ + @ExecFunction(hasVarArgs = true, name = "json_extract", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression jsonExtract(VarcharLiteral first, VarcharLiteral... second) { + StringBuilder sb = new StringBuilder(); + List keys = new ArrayList<>(); + for (VarcharLiteral item : second) { + keys.add(item.getValue()); + } + List extractedValues = jsonExtract(first.getValue(), keys.toArray(new String[0])); + sb.append(extractedValues); return new VarcharLiteral(sb.toString()); } + /** + * Executable arithmetic functions jsonb_extract_string + */ + @ExecFunction(hasVarArgs = false, name = "jsonb_extract_string", argTypes = {"JSON", "VARCHAR"}, returnType = "STRING") + public static Expression jsonbExtractstring(JsonLiteral first, VarcharLiteral second) { + StringBuilder sb = new StringBuilder(); + JSONObject jsonObject = new JSONObject(first.getValue()); + Object currentObject = jsonExtractUnit(jsonObject, second.getValue()); + sb.append(currentObject.toString()); + return new StringLiteral(sb.toString()); + } + + + + + /** + * Executable arithmetic functions jsonContains + */ + @ExecFunction(hasVarArgs = false, name = "json_contains", argTypes = {"JSON", "JSON", "VARCHAR"}, returnType = "BOOLEAN") + public static Expression jsonContains(JsonLiteral first, JsonLiteral second, VarcharLiteral third) { + return BooleanLiteral.TRUE; + } + } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java index 3a98ee6252791a..54da56427acc3d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java @@ -137,73 +137,73 @@ private static LocalDateTime getDateCeilOrFloor(DATE tag, LocalDateTime date, in /** * datetime arithmetic function year-ceil */ - @ExecFunction(name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -212,73 +212,73 @@ public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function month-ceil */ - @ExecFunction(name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -287,73 +287,73 @@ public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function day-ceil */ - @ExecFunction(name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -362,73 +362,73 @@ public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-ceil */ - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -437,73 +437,73 @@ public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function minute-ceil */ - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -513,73 +513,73 @@ public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function SECOND-ceil */ - @ExecFunction(name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), @@ -589,73 +589,73 @@ public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function year-floor */ - @ExecFunction(name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -664,73 +664,73 @@ public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function month-floor */ - @ExecFunction(name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), @@ -740,73 +740,73 @@ public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function day-floor */ - @ExecFunction(name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -815,73 +815,73 @@ public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-floor */ - @ExecFunction(name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -890,73 +890,73 @@ public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function minute-floor */ - @ExecFunction(name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -966,73 +966,73 @@ public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral peri /** * datetime arithmetic function SECOND-floor */ - @ExecFunction(name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), From 84ba0b7f143c897e24b050499b50ecdf6e9a49ba Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Thu, 5 Sep 2024 18:33:15 +0800 Subject: [PATCH 4/8] support more functions --- .../trees/expressions/ExecFunction.java | 2 +- .../expressions/ExpressionEvaluator.java | 3 +- .../functions/executable/DateTimeAcquire.java | 20 +- .../executable/DateTimeArithmetic.java | 126 ++-- .../DateTimeExtractAndTransform.java | 281 +++---- .../executable/ExecutableFunctions.java | 27 +- .../executable/NumericArithmetic.java | 174 ++--- .../executable/StringArithmetic.java | 712 +++++++++++++++++- .../functions/executable/TimeRoundSeries.java | 324 ++++---- .../expressions/functions/scalar/Field.java | 28 +- 10 files changed, 1195 insertions(+), 502 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java index 6aa5f800268b8c..68163a733c79a3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java @@ -47,5 +47,5 @@ /** * hasVarArgsc */ - boolean hasVarArgs(); + boolean varArgs(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java index f513eff9de5b33..b10aa4de020971 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java @@ -32,7 +32,6 @@ import org.apache.doris.nereids.trees.expressions.literal.DateLiteral; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; -import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; import org.apache.doris.nereids.types.DataType; import org.apache.doris.nereids.util.TypeCoercionUtils; @@ -220,7 +219,7 @@ private void registerFEFunction(ImmutableMultimap.Builder 32536771199L) { @@ -497,17 +497,17 @@ public static Expression fromUnixTime(BigIntLiteral second, StringLikeLiteral fo /** * date transformation function: unix_timestamp */ - @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") public static Expression unixTimestamp(DateLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") public static Expression unixTimestamp(DateTimeLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") public static Expression unixTimestamp(DateV2Literal date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } @@ -515,7 +515,7 @@ public static Expression unixTimestamp(DateV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") public static Expression unixTimestamp(DateTimeV2Literal date) { if (date.getMicroSecond() == 0) { return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(10, 0), @@ -529,7 +529,7 @@ public static Expression unixTimestamp(DateTimeV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(hasVarArgs = false, name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") public static Expression unixTimestamp(StringLikeLiteral date, StringLikeLiteral format) { DateTimeFormatter formatter = DateUtils.formatBuilder(format.getValue()).toFormatter(); LocalDateTime dateObj; @@ -564,12 +564,12 @@ private static String getTimestamp(LocalDateTime dateTime) { /** * date transformation function: to_date */ - @ExecFunction(hasVarArgs = false, name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(varArgs = false, name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression toDate(DateTimeLiteral date) { return new DateLiteral(date.getYear(), date.getMonth(), date.getDay()); } - @ExecFunction(hasVarArgs = false, name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression toDate(DateTimeV2Literal date) { return new DateV2Literal(date.getYear(), date.getMonth(), date.getDay()); } @@ -577,25 +577,25 @@ public static Expression toDate(DateTimeV2Literal date) { /** * date transformation function: to_days */ - @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATE"}, returnType = "INT") public static Expression toDays(DateLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") public static Expression toDays(DateTimeLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") public static Expression toDays(DateV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(hasVarArgs = false, name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression toDays(DateTimeV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); @@ -604,7 +604,7 @@ public static Expression toDays(DateTimeV2Literal date) { /** * date transformation function: makedate */ - @ExecFunction(hasVarArgs = false, name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") + @ExecFunction(varArgs = false, name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) { int day = dayOfYear.getValue(); return day > 0 ? DateLiteral.fromJavaDateType(LocalDateTime.of(year.getValue(), 1, 1, 0, 0, 0) @@ -614,7 +614,7 @@ public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) /** * date transformation function: str_to_date */ - @ExecFunction(hasVarArgs = false, name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral format) { if (org.apache.doris.analysis.DateLiteral.hasTimePart(format.getStringValue())) { DataType returnType = DataType.fromCatalogType(ScalarType.getDefaultDateType(Type.DATETIME)); @@ -637,12 +637,12 @@ public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral form } } - @ExecFunction(hasVarArgs = false, name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression timestamp(DateTimeLiteral datetime) { return datetime; } - @ExecFunction(hasVarArgs = false, name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression timestamp(DateTimeV2Literal datetime) { return datetime; } @@ -650,7 +650,8 @@ public static Expression timestamp(DateTimeV2Literal datetime) { /** * convert_tz */ - @ExecFunction(hasVarArgs = false, name = "convert_tz", argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "convert_tz", + argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral fromTz, StringLikeLiteral toTz) { DateTimeFormatter zoneFormatter = new DateTimeFormatterBuilder() .parseCaseInsensitive() @@ -665,52 +666,52 @@ public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral return DateTimeV2Literal.fromJavaDateType(resultDateTime.toLocalDateTime(), datetime.getDataType().getScale()); } - @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression weekDay(DateLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekDay(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekDay(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(hasVarArgs = false, name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekDay(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression week(DateV2Literal date) { return week(date.toJavaDateType(), 0); } - @ExecFunction(hasVarArgs = false, name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateV2Literal date, IntegerLiteral mode) { return week(date.toJavaDateType(), mode.getIntValue()); } @@ -775,32 +776,32 @@ private static boolean isSpecificDate(LocalDateTime localDateTime) { && (localDateTime.getDayOfMonth() == 1 || localDateTime.getDayOfMonth() == 2); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date, IntegerLiteral mode) { return yearWeek(date.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date) { return yearWeek(date.toJavaDateType(), 0); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } - @ExecFunction(hasVarArgs = false, name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } @@ -868,7 +869,7 @@ public static Expression yearWeek(LocalDateTime localDateTime, int mode) { /** * weekofyear */ - @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeV2Literal dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -883,7 +884,7 @@ public static Expression weekOfYear(DateTimeV2Literal dateTime) { /** * weekofyear */ - @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeLiteral dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -898,7 +899,7 @@ public static Expression weekOfYear(DateTimeLiteral dateTime) { /** * weekofyear */ - @ExecFunction(hasVarArgs = false, name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateV2Literal date) { if (date.getYear() == 0 && date.getDayOfWeek() == 1) { if (date.getMonth() == 1 && date.getDay() == 2) { @@ -909,53 +910,53 @@ public static Expression weekOfYear(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().get(WeekFields.ISO.weekOfWeekBasedYear())); } - @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression dayName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression dayName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression dayName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression monthName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression monthName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression monthName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(hasVarArgs = false, name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromSecond(BigIntLiteral second) { return fromMicroSecond(second.getValue() * 1000 * 1000); } - @ExecFunction(hasVarArgs = false, name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMilliSecond(BigIntLiteral milliSecond) { return fromMicroSecond(milliSecond.getValue() * 1000); } - @ExecFunction(hasVarArgs = false, name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMicroSecond(BigIntLiteral microSecond) { return fromMicroSecond(microSecond.getValue()); } @@ -972,187 +973,191 @@ private static Expression fromMicroSecond(long microSecond) { dateTime.getMinute(), dateTime.getSecond(), dateTime.getNano() / 1000); } - @ExecFunction(hasVarArgs = false, name = "microseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "microseconds_diff", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression microsecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MICROS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "milliseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "milliseconds_diff", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression millisecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MILLIS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "seconds_diff", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "minutes_diff", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(hasVarArgs = false, name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java index c1feef1a6c0947..27c3bfe1a4fff8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java @@ -47,47 +47,47 @@ public class ExecutableFunctions { /** * other scalar function */ - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") public static Expression abs(TinyIntLiteral literal) { return new SmallIntLiteral((short) Math.abs(literal.getValue())); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") public static Expression abs(SmallIntLiteral literal) { return new IntegerLiteral(Math.abs(literal.getValue())); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"INT"}, returnType = "BIGINT") public static Expression abs(IntegerLiteral literal) { return new BigIntLiteral(Math.abs((long) literal.getValue())); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") public static Expression abs(BigIntLiteral literal) { return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") public static Expression abs(LargeIntLiteral literal) { return new LargeIntLiteral(literal.getValue().abs()); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") public static Expression abs(FloatLiteral literal) { return new FloatLiteral(Math.abs(literal.getValue())); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression abs(DoubleLiteral literal) { return new DoubleLiteral(Math.abs(literal.getValue())); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") public static Expression abs(DecimalLiteral literal) { return new DecimalLiteral(literal.getValue().abs()); } - @ExecFunction(hasVarArgs = false, name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") public static Expression abs(DecimalV3Literal literal) { return new DecimalV3Literal(literal.getValue().abs()); } @@ -95,7 +95,7 @@ public static Expression abs(DecimalV3Literal literal) { /** * acos scalar function */ - @ExecFunction(hasVarArgs = false, name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression acos(DoubleLiteral literal) { double result = Math.acos(literal.getValue()); if (Double.isNaN(result)) { @@ -105,7 +105,8 @@ public static Expression acos(DoubleLiteral literal) { } } - @ExecFunction(hasVarArgs = false, name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "append_trailing_char_if_absent", + argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, StringLikeLiteral chr) { if (literal.getValue().length() != 1) { return null; @@ -114,12 +115,12 @@ public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, S : new VarcharLiteral(literal.getValue() + chr.getValue()); } - @ExecFunction(hasVarArgs = false, name = "e", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "e", argTypes = {}, returnType = "DOUBLE") public static Expression e() { // CHECKSTYLE IGNORE THIS LINE return new DoubleLiteral(Math.E); } - @ExecFunction(hasVarArgs = false, name = "p1", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "p1", argTypes = {}, returnType = "DOUBLE") public static Expression pi() { return new DoubleLiteral(Math.PI); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java index 9a8c49a96a4ec5..8f1937c83a1fbb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java @@ -41,169 +41,169 @@ public class NumericArithmetic { /** * Executable arithmetic functions add */ - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression addTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.addExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression addTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression addTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression addTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression addSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression addSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression addSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression addSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression addIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression addIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression addIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression addIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression addBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression addBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression addBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression addBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") public static Expression addLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") public static Expression addLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") public static Expression addLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") public static Expression addLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression addDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() + second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(varArgs = false, name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression addDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -212,169 +212,169 @@ public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3 /** * Executable arithmetic functions subtract */ - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression subtractTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.subtractExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression subtractTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression subtractTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression subtractSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression subtractSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression subtractSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression subtractIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression subtractBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression subtractLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression subtractDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() - second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression subtractDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -383,163 +383,163 @@ public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions multiply */ - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression multiplyTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.multiplyExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression multiplyTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression multiplyTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression multiplySmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression multiplySmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression multiplySmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplySmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplySmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression multiplyIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression multiplyBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression multiplyLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression multiplyDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() * second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().multiply(second.getValue()); return new DecimalLiteral(result); @@ -548,7 +548,7 @@ public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLit /** * decimalV3 multiply in FE */ - @ExecFunction(hasVarArgs = false, name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().multiply(second.getValue()); DecimalV3Type t1 = (DecimalV3Type) first.getDataType(); @@ -561,7 +561,7 @@ public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions divide */ - @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(varArgs = false, name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) { if (second.getValue() == 0.0) { return new NullLiteral(first.getDataType()); @@ -573,7 +573,7 @@ public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) /** * Executable arithmetic functions divide */ - @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(varArgs = false, name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral second) { if (first.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); @@ -585,7 +585,7 @@ public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral seco /** * decimalv3 divide in FE */ - @ExecFunction(hasVarArgs = false, name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(varArgs = false, name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Literal second) { if (second.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 5c67bd6504bb5e..cd094a228382c1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -17,17 +17,40 @@ package org.apache.doris.nereids.trees.expressions.functions.executable; -import org.apache.commons.codec.digest.DigestUtils; import org.apache.doris.nereids.trees.expressions.ExecFunction; import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.literal.*; +import org.apache.doris.nereids.trees.expressions.literal.ArrayLiteral; +import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral; +import org.apache.doris.nereids.trees.expressions.literal.DateTimeLiteral; +import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal; +import org.apache.doris.nereids.trees.expressions.literal.DecimalLiteral; +import org.apache.doris.nereids.trees.expressions.literal.DecimalV3Literal; +import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; +import org.apache.doris.nereids.trees.expressions.literal.FloatLiteral; +import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; +import org.apache.doris.nereids.trees.expressions.literal.JsonLiteral; +import org.apache.doris.nereids.trees.expressions.literal.LargeIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.Literal; +import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; +import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; +import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; + +import org.json.JSONArray; import org.json.JSONObject; -import javax.validation.constraints.Null; import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Base64; import java.util.List; /** @@ -38,7 +61,7 @@ public class StringArithmetic { /** * Executable arithmetic functions concat */ - @ExecFunction(hasVarArgs = false, name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiteral second) { String result = first.getValue() + second.getValue(); return new VarcharLiteral(result); @@ -47,7 +70,7 @@ public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiter /** * Executable arithmetic functions substring */ - @ExecFunction(hasVarArgs = false, name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { int stringLength = first.getValue().length(); if (stringLength == 0) { @@ -77,7 +100,7 @@ public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLit /** * Executable arithmetic functions length */ - @ExecFunction(hasVarArgs = false, name = "length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "length", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression lengthVarchar(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -85,7 +108,7 @@ public static Expression lengthVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Lower */ - @ExecFunction(hasVarArgs = false, name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression lowerVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toLowerCase()); } @@ -93,7 +116,7 @@ public static Expression lowerVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Upper */ - @ExecFunction(hasVarArgs = false, name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression upperVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toUpperCase()); } @@ -101,7 +124,7 @@ public static Expression upperVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Trim */ - @ExecFunction(hasVarArgs = false, name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression trimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().strip()); } @@ -109,7 +132,7 @@ public static Expression trimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions LTrim */ - @ExecFunction(hasVarArgs = false, name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression ltrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripLeading()); } @@ -117,7 +140,7 @@ public static Expression ltrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions RTrim */ - @ExecFunction(hasVarArgs = false, name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression rtrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripTrailing()); } @@ -125,7 +148,8 @@ public static Expression rtrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Replace */ - @ExecFunction(hasVarArgs = false, name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "replace", + argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression replace(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { if (second.getValue().length() == 0) { return new VarcharLiteral(first.getValue()); @@ -136,7 +160,7 @@ public static Expression replace(VarcharLiteral first, VarcharLiteral second, Va /** * Executable arithmetic functions Left */ - @ExecFunction(hasVarArgs = false, name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression left(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -150,7 +174,7 @@ public static Expression left(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Right */ - @ExecFunction(hasVarArgs = false, name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression right(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -165,7 +189,7 @@ public static Expression right(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Locate */ - @ExecFunction(hasVarArgs = false, name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression locate(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(first.getValue().strip().indexOf(second.getValue())); } @@ -173,7 +197,7 @@ public static Expression locate(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Instr */ - @ExecFunction(hasVarArgs = false, name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression instr(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); } @@ -181,7 +205,7 @@ public static Expression instr(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Ascii */ - @ExecFunction(hasVarArgs = false, name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression ascii(VarcharLiteral first) { if (first.getValue().length() == 0) { return new IntegerLiteral(0); @@ -193,7 +217,7 @@ public static Expression ascii(VarcharLiteral first) { /** * Executable arithmetic functions Bin */ - @ExecFunction(hasVarArgs = false, name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression bin(BigIntLiteral first) { return new VarcharLiteral(Long.toBinaryString(first.getValue())); } @@ -201,7 +225,7 @@ public static Expression bin(BigIntLiteral first) { /** * Executable arithmetic functions Hex */ - @ExecFunction(hasVarArgs = false, name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression hexBigInt(BigIntLiteral first) { return new VarcharLiteral(Long.toHexString(first.getValue())); } @@ -209,7 +233,7 @@ public static Expression hexBigInt(BigIntLiteral first) { /** * Executable arithmetic functions Hex */ - @ExecFunction(hasVarArgs = false, name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression hexVarchar(VarcharLiteral first) { return new VarcharLiteral(Long.toHexString(Long.valueOf(first.getValue()))); } @@ -217,7 +241,7 @@ public static Expression hexVarchar(VarcharLiteral first) { /** * Executable arithmetic functions UnHex */ - @ExecFunction(hasVarArgs = false, name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression unHexVarchar(VarcharLiteral first) { return new VarcharLiteral(Long.toBinaryString(Long.valueOf(first.getValue()))); } @@ -225,7 +249,7 @@ public static Expression unHexVarchar(VarcharLiteral first) { /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(hasVarArgs = false, name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue().size() - 1; i++) { @@ -241,7 +265,7 @@ public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(hasVarArgs = true, name = "concat_ws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = true, name = "concat_ws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLiteral... second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.length - 1; i++) { @@ -255,7 +279,7 @@ public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLit /** * Executable arithmetic functions Char */ - @ExecFunction(hasVarArgs = true, name = "char", argTypes = {"STRING", "INT"}, returnType = "STRING") + @ExecFunction(varArgs = true, name = "char", argTypes = {"STRING", "INT"}, returnType = "STRING") public static Expression charStringInt(StringLiteral first, IntegerLiteral... second) { StringBuilder sb = new StringBuilder(); for (IntegerLiteral item : second) { @@ -274,7 +298,7 @@ public static Expression charStringInt(StringLiteral first, IntegerLiteral... se /** * Executable arithmetic functions CharacterLength */ - @ExecFunction(hasVarArgs = false, name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(varArgs = false, name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression characterLength(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -282,7 +306,7 @@ public static Expression characterLength(VarcharLiteral first) { /** * Executable arithmetic functions initCap */ - @ExecFunction(hasVarArgs = false, name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression initCap(VarcharLiteral first) { StringBuilder result = new StringBuilder(first.getValue().length()); boolean capitalizeNext = true; @@ -304,7 +328,7 @@ public static Expression initCap(VarcharLiteral first) { /** * Executable arithmetic functions md5 */ - @ExecFunction(hasVarArgs = false, name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = false, name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression md5(VarcharLiteral first) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -319,7 +343,7 @@ public static Expression md5(VarcharLiteral first) { /** * Executable arithmetic functions md5 */ - @ExecFunction(hasVarArgs = true, name = "md5sum", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = true, name = "md5sum", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression md5Sum(VarcharLiteral... first) { try { // Step 1: Create a MessageDigest instance for MD5 @@ -383,6 +407,7 @@ private static Object jsonExtractUnit(JSONObject jsonObject, String unitKey) { } return currentObject; } + private static List jsonExtract(String jsonString, String... jsonPaths) { List extractedValues = new ArrayList<>(); JSONObject jsonObject = new JSONObject(jsonString); @@ -398,7 +423,7 @@ private static List jsonExtract(String jsonString, String... jsonPaths) /** * Executable arithmetic functions jsonContains */ - @ExecFunction(hasVarArgs = true, name = "json_extract", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(varArgs = true, name = "json_extract", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression jsonExtract(VarcharLiteral first, VarcharLiteral... second) { StringBuilder sb = new StringBuilder(); List keys = new ArrayList<>(); @@ -413,7 +438,7 @@ public static Expression jsonExtract(VarcharLiteral first, VarcharLiteral... sec /** * Executable arithmetic functions jsonb_extract_string */ - @ExecFunction(hasVarArgs = false, name = "jsonb_extract_string", argTypes = {"JSON", "VARCHAR"}, returnType = "STRING") + @ExecFunction(varArgs = false, name = "jsonb_extract_string", argTypes = {"JSON", "VARCHAR"}, returnType = "STRING") public static Expression jsonbExtractstring(JsonLiteral first, VarcharLiteral second) { StringBuilder sb = new StringBuilder(); JSONObject jsonObject = new JSONObject(first.getValue()); @@ -422,15 +447,636 @@ public static Expression jsonbExtractstring(JsonLiteral first, VarcharLiteral se return new StringLiteral(sb.toString()); } + /** + * Checks if a JSON string contains a specific value at a specified path or anywhere in the JSON. + * @param jsonString the input JSON string + * @param value the value to check for + * @param jsonPath (optional) the path to check the value at + * @return true if the JSON contains the value, false otherwise + */ + private static boolean jsonContains(String jsonString, String value, String jsonPath) { + Object jsonObject = null; + // Determine if the input is a JSONArray or JSONObject + if (jsonString.trim().startsWith("[")) { + jsonObject = new JSONArray(jsonString); // Input is a JSONArray + } else { + jsonObject = new JSONObject(jsonString); + } + + if (!jsonPath.equals("$")) { + // If a JSON path is provided, search at that specific path + String[] keys = jsonPath.replace("$.", "").split("\\."); + Object currentObject = jsonObject; + + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + + if (key.endsWith("]")) { // Handle array index access + int arrayStartIndex = key.indexOf('['); + String arrayKey = key.substring(0, arrayStartIndex); + int arrayIndex = Integer.parseInt(key.substring(arrayStartIndex + 1, key.length() - 1)); + + if (currentObject instanceof JSONObject) { + JSONArray jsonArray = ((JSONObject) currentObject).getJSONArray(arrayKey); + if (i == keys.length - 1) { + // At the last key in the path, check if the value matches the array element + return jsonArray.get(arrayIndex).toString().equals(value); + } else { + currentObject = jsonArray.get(arrayIndex); + } + } + } else { + if (currentObject instanceof JSONObject) { + if (!((JSONObject) currentObject).has(key)) { + return false; + } + currentObject = ((JSONObject) currentObject).get(key); + } + } + } + return currentObject.toString().equals(value); + } else { + // If no JSON path is provided, search for the value anywhere in the JSON + return jsonContainsAnywhere(jsonObject, value); + } + } + + /** + * Recursively checks if the value exists anywhere in the JSON object. + * @param jsonObject the input JSONObject + * @param value the value to check for + * @return true if the value is found, false otherwise + */ + private static boolean jsonContainsAnywhere(Object jsonObject, String value) { + if (jsonObject.toString().equals(value)) { + return true; + } + if (jsonObject instanceof JSONObject) { + JSONObject json = (JSONObject) jsonObject; + for (String key : json.keySet()) { + Object currentValue = json.get(key); + if (jsonContainsAnywhere(currentValue, value)) { + return true; + } + } + } else if (jsonObject instanceof JSONArray) { + JSONArray jsonArray = (JSONArray) jsonObject; + for (int i = 0; i < jsonArray.length(); i++) { + if (jsonContainsAnywhere(jsonArray.get(i), value)) { + return true; + } + } + } else { + return jsonObject.toString().equals(value); + } + return false; + } + /** + * Executable arithmetic functions jsonContains + */ + @ExecFunction(varArgs = false, name = "json_contains", + argTypes = {"JSON", "JSON", "STRING"}, returnType = "BOOLEAN") + public static Expression jsonContainsString(JsonLiteral first, JsonLiteral second, StringLiteral third) { + if (jsonContains(first.getValue(), second.getValue(), third.getValue())) { + return BooleanLiteral.TRUE; + } else { + return BooleanLiteral.FALSE; + } + } + /** + * Executable arithmetic functions jsonContains + */ + @ExecFunction(varArgs = false, name = "json_length", argTypes = {"JSON", "VARCHAR"}, returnType = "INT") + public static Expression jsonLengthVarchar(JsonLiteral first, VarcharLiteral second) { + if (second.getValue().equals("$")) { + return new IntegerLiteral(first.getValue().length()); + } + Object jsonObject = null; + // Determine if the input is a JSONArray or JSONObject + if (second.getValue().trim().startsWith("[")) { + jsonObject = new JSONArray(second.getValue()); // Input is a JSONArray + } else { + jsonObject = new JSONObject(second.getValue()); + } + return new IntegerLiteral(jsonObject.toString().length()); + } /** * Executable arithmetic functions jsonContains */ - @ExecFunction(hasVarArgs = false, name = "json_contains", argTypes = {"JSON", "JSON", "VARCHAR"}, returnType = "BOOLEAN") - public static Expression jsonContains(JsonLiteral first, JsonLiteral second, VarcharLiteral third) { - return BooleanLiteral.TRUE; + @ExecFunction(varArgs = false, name = "json_length", argTypes = {"JSON", "STRING"}, returnType = "INT") + public static Expression jsonLengthString(JsonLiteral first, StringLiteral second) { + if (second.getValue().equals("$")) { + return new IntegerLiteral(first.getValue().length()); + } + Object jsonObject = null; + // Determine if the input is a JSONArray or JSONObject + if (second.getValue().trim().startsWith("[")) { + jsonObject = new JSONArray(second.getValue()); // Input is a JSONArray + } else { + jsonObject = new JSONObject(second.getValue()); + } + return new IntegerLiteral(jsonObject.toString().length()); + } + + private static int compareLiteral(Literal first, Literal... second) { + for (int i = 0; i < second.length; i++) { + if (second[i].getValue().equals(first.getValue())) { + return i + 1; + } + } + return 0; + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"INT", "INT"}, returnType = "INT") + public static Expression fieldInt(IntegerLiteral first, IntegerLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"TINYINT", "TINYINT"}, returnType = "INT") + public static Expression fieldTinyInt(TinyIntLiteral first, TinyIntLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + public static Expression fieldSmallInt(SmallIntLiteral first, SmallIntLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"BIGINT", "BIGINT"}, returnType = "INT") + public static Expression fieldBigInt(BigIntLiteral first, BigIntLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "INT") + public static Expression fieldLargeInt(LargeIntLiteral first, LargeIntLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"FLOAT", "FLOAT"}, returnType = "INT") + public static Expression fieldFloat(FloatLiteral first, FloatLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "INT") + public static Expression fieldDouble(DoubleLiteral first, DoubleLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"DECIMAL", "DECIMAL"}, returnType = "INT") + public static Expression fieldDecimalV2(DecimalLiteral first, DecimalLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "INT") + public static Expression fieldDecimalV3(DecimalV3Literal first, DecimalV3Literal... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") + public static Expression fieldDateTime(DateTimeLiteral first, DateTimeLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") + public static Expression fieldDateTimeV2(DateTimeV2Literal first, DateTimeV2Literal... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + public static Expression fieldVarchar(VarcharLiteral first, VarcharLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + /** + * Executable arithmetic functions field + */ + @ExecFunction(varArgs = true, name = "field", argTypes = {"STRING", "STRING"}, returnType = "INT") + public static Expression fieldString(StringLiteral first, StringLiteral... second) { + return new IntegerLiteral(compareLiteral(first, second)); + } + + private static int findStringInSet(String target, String input) { + String[] split = input.split(","); + for (int i = 0; i < split.length; i++) { + if (split[i].equals(target)) { + return i + 1; + } + } + return 0; + } + + /** + * Executable arithmetic functions find_in_set + */ + @ExecFunction(varArgs = false, name = "find_in_set", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + public static Expression findInSetVarchar(VarcharLiteral first, VarcharLiteral second) { + return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); + } + + /** + * Executable arithmetic functions find_in_set + */ + @ExecFunction(varArgs = false, name = "find_in_set", argTypes = {"STRING", "STRING"}, returnType = "INT") + public static Expression findInSetString(StringLiteral first, StringLiteral second) { + return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); + } + + /** + * Executable arithmetic functions repeat + */ + @ExecFunction(varArgs = false, name = "repeat", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression repeat(VarcharLiteral first, IntegerLiteral second) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < second.getValue(); i++) { + sb.append(first.getValue()); + } + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions reverse + */ + @ExecFunction(varArgs = false, name = "reverse", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression reverseVarchar(VarcharLiteral first) { + StringBuilder sb = new StringBuilder(); + sb.append(first.getValue()); + return new VarcharLiteral(sb.reverse().toString()); + } + + /** + * Executable arithmetic functions reverse + */ + @ExecFunction(varArgs = false, name = "reverse", argTypes = {"STRING"}, returnType = "STRING") + public static Expression reverseString(VarcharLiteral first) { + StringBuilder sb = new StringBuilder(); + sb.append(first.getValue()); + return new VarcharLiteral(sb.reverse().toString()); + } + + /** + * Executable arithmetic functions space + */ + @ExecFunction(varArgs = false, name = "space", argTypes = {"INT"}, returnType = "VARCHAR") + public static Expression space(IntegerLiteral first) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < first.getValue(); i++) { + sb.append(' '); + } + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions split_by_char + */ + @ExecFunction(varArgs = false, name = "split_by_char", + argTypes = {"STRING", "STRING"}, returnType = "ARRAY") + public static Expression splitByChar(StringLiteral first, StringLiteral second) { + String[] result = first.getValue().split(second.getValue()); + List items = new ArrayList<>(); + for (int i = 1; i < result.length; i++) { + items.add(new StringLiteral(result[i])); + } + return new ArrayLiteral(items); + } + + /** + * Executable arithmetic functions split_by_string + */ + @ExecFunction(varArgs = false, name = "split_by_char", + argTypes = {"STRING", "STRING"}, returnType = "ARRAY") + public static Expression splitByString(StringLiteral first, StringLiteral second) { + String[] result = first.getValue().split(second.getValue()); + List items = new ArrayList<>(); + for (int i = 1; i < result.length; i++) { + items.add(new StringLiteral(result[i])); + } + return new ArrayLiteral(items); + } + + /** + * Executable arithmetic functions split_part + */ + @ExecFunction(varArgs = false, name = "split_part", + argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { + String[] parts = literal.getValue().split(chr.getValue()); + if (parts.length < number.getValue() || number.getValue() < (- parts.length) || number.getValue() == 0) { + return new VarcharLiteral(""); + } else if (number.getValue() < 0) { + return new VarcharLiteral(parts[parts.length + number.getValue()]); + } else { + return new VarcharLiteral(parts[number.getValue() - 1]); + } + } + + /** + * Executable arithmetic functions substring_index + */ + @ExecFunction(varArgs = false, name = "substring_index", + argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { + String[] parts = literal.getValue().split(chr.getValue()); + int leftIndex; + int rightIndex; + if (parts.length < number.getValue() || number.getValue() < (- parts.length) || number.getValue() == 0) { + return new VarcharLiteral(""); + } else if (number.getValue() < 0) { + leftIndex = parts.length + number.getValue(); + rightIndex = parts.length; + } else { + leftIndex = 0; + rightIndex = number.getValue(); + } + StringBuilder sb = new StringBuilder(); + for (int i = leftIndex; i < rightIndex - 1; i++) { + sb.append(parts[i]); + sb.append(chr.getValue()); + } + sb.append(parts[rightIndex - 1]); + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions strcmp + */ + @ExecFunction(varArgs = false, name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") + public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { + if (first.getValue().equals(second.getValue())) { + return new TinyIntLiteral((byte) 1); + } else { + return new TinyIntLiteral((byte) 0); + } + } + + /** + * Executable arithmetic functions strLeft + */ + @ExecFunction(varArgs = false, name = "strleft", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { + if (second.getValue() <= 0) { + return new VarcharLiteral(""); + } else if (second.getValue() > first.getValue().length()) { + return first; + } else { + return new VarcharLiteral(first.getValue().substring(0, second.getValue())); + } + } + + /** + * Executable arithmetic functions strRight + */ + @ExecFunction(varArgs = false, name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { + if (second.getValue() <= 0) { + return new VarcharLiteral(""); + } else if (second.getValue() > first.getValue().length()) { + return first; + } else { + return new VarcharLiteral(first.getValue().substring( + first.getValue().length() - second.getValue(), first.getValue().length())); + } + } + + /** + * Executable arithmetic functions overlay + */ + @ExecFunction(varArgs = false, name = "overlay", + argTypes = {"VARCHAR", "INT", "INT", "VARCHAR"}, returnType = "VARCHAR") + public static Expression overlay(VarcharLiteral first, + IntegerLiteral second, IntegerLiteral third, VarcharLiteral four) { + StringBuilder sb = new StringBuilder(); + if (second.getValue() <= 0 || second.getValue() > first.getValue().length()) { + return new VarcharLiteral(""); + } else { + if (third.getValue() < 0 || third.getValue() > (first.getValue().length() - third.getValue())) { + sb.append(first.getValue().substring(0, second.getValue() - 1)); + sb.append(four.getValue()); + return new VarcharLiteral(sb.toString()); + } else { + sb.append(first.getValue().substring(0, second.getValue() - 1)); + sb.append(four.getValue()); + sb.append(first.getValue().substring(second.getValue() + + third.getValue() - 1, first.getValue().length())); + return new VarcharLiteral(sb.toString()); + } + } + } + + /** + * Executable arithmetic functions parseurl + */ + @ExecFunction(varArgs = false, name = "parse_url", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression parseurl(VarcharLiteral first, VarcharLiteral second) { + URI uri = null; + try { + uri = new URI(first.getValue()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + StringBuilder sb = new StringBuilder(); + switch (second.getValue().toUpperCase()) { + case "PROTOCOL": + sb.append(uri.getScheme()); // e.g., http, https + break; + case "HOST": + sb.append(uri.getHost()); // e.g., www.example.com + break; + case "PATH": + sb.append(uri.getPath()); // e.g., /page + break; + case "REF": + try { + sb.append(uri.toURL().getRef()); // e.g., /page + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + break; + case "AUTHORITY": + sb.append(uri.getAuthority()); // e.g., param1=value1¶m2=value2 + break; + case "FILE": + try { + sb.append(uri.toURL().getFile()); // e.g., param1=value1¶m2=value2 + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + break; + case "QUERY": + sb.append(uri.getQuery()); // e.g., param1=value1¶m2=value2 + break; + case "PORT": + sb.append(uri.getPort()); + break; + case "USERINFO": + sb.append(uri.getUserInfo()); // e.g., user:pass + break; + default: + throw new RuntimeException("Valid URL parts are 'PROTOCOL', 'HOST', " + + "'PATH', 'REF', 'AUTHORITY', 'FILE', 'USERINFO', 'PORT' and 'QUERY'"); + } + return new VarcharLiteral(sb.toString()); + } + + /** + * Executable arithmetic functions urldecode + */ + @ExecFunction(varArgs = false, name = "url_decode", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression urlDecode(VarcharLiteral first) { + try { + return new VarcharLiteral(URLDecoder.decode(first.getValue(), StandardCharsets.UTF_8.name())); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + /** + * Executable arithmetic functions decodeasvarchar + */ + @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"SMALLINT"}, returnType = "VARCHAR") + public static Expression decodeasvarcharSmallint(SmallIntLiteral first) { + return new VarcharLiteral(first.getValue().toString()); + } + + /** + * Executable arithmetic functions decodeasvarchar + */ + @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"INT"}, returnType = "VARCHAR") + public static Expression decodeasvarcharInt(IntegerLiteral first) { + return new VarcharLiteral(first.getValue().toString()); + } + + /** + * Executable arithmetic functions decodeasvarchar + */ + @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"BIGINT"}, returnType = "VARCHAR") + public static Expression decodeasvarcharBigint(BigIntLiteral first) { + return new VarcharLiteral(first.getValue().toString()); + } + + /** + * Executable arithmetic functions decodeasvarchar + */ + @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"LARGEINT"}, returnType = "VARCHAR") + public static Expression decodeasvarcharLargeint(LargeIntLiteral first) { + return new VarcharLiteral(first.getValue().toString()); + } + + /** + * Executable arithmetic functions append_trailing_char_if_absent + */ + @ExecFunction(varArgs = false, name = "append_trailing_char_if_absent", + argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression appendTrailingCharIfAbsent(VarcharLiteral first, VarcharLiteral second) { + if (first.getValue().endsWith(second.getValue())) { + return first; + } else { + return new VarcharLiteral(first.getValue() + second.getValue()); + } + } + + /** + * Executable arithmetic functions endsWith + */ + @ExecFunction(varArgs = false, name = "ends_with", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "BOOLEAN") + public static Expression endsWith(VarcharLiteral first, VarcharLiteral second) { + if (first.getValue().endsWith(second.getValue())) { + return BooleanLiteral.TRUE; + } else { + return BooleanLiteral.FALSE; + } + } + + /** + * Executable arithmetic functions extractUrlParameter + */ + @ExecFunction(varArgs = false, name = "extract_url_parameter", + argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression extractUrlParameter(VarcharLiteral first, VarcharLiteral second) { + if (first.getValue() == null || first.getValue().indexOf('?') == -1) { + return new VarcharLiteral(""); + } + + String[] urlParts = first.getValue().split("\\?"); + if (urlParts.length > 1) { + String query = urlParts[1]; + String[] pairs = query.split("&"); + + for (String pair : pairs) { + String[] keyValue = pair.split("="); + if (second.getValue().equals(keyValue[0])) { + return new VarcharLiteral(keyValue[1]); + } + } + } + return new VarcharLiteral(""); + } + + /** + * Executable arithmetic functions quote + */ + @ExecFunction(varArgs = false, name = "quote", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + public static Expression quote(VarcharLiteral first) { + return new VarcharLiteral("\'" + first.getValue() + "\'"); + } + + /** + * Executable arithmetic functions toBase64 + */ + @ExecFunction(varArgs = false, name = "to_base64", argTypes = {"STRING"}, returnType = "STRING") + public static Expression toBase64(VarcharLiteral first) { + // Convert the string to bytes + byte[] strBytes = first.getValue().getBytes(); + // Encode the bytes to Base64 + String encodedStr = Base64.getEncoder().encodeToString(strBytes); + return new VarcharLiteral(encodedStr); + } + + /** + * Executable arithmetic functions replaceEmpty + */ + @ExecFunction(varArgs = false, name = "replace_empty", + argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression replaceEmpty(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { + return new VarcharLiteral(first.getValue().replace(second.getValue(), third.getValue())); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java index 54da56427acc3d..58682f5f03c626 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java @@ -137,73 +137,76 @@ private static LocalDateTime getDateCeilOrFloor(DATE tag, LocalDateTime date, in /** * datetime arithmetic function year-ceil */ - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -212,73 +215,76 @@ public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function month-ceil */ - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -287,73 +293,76 @@ public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function day-ceil */ - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -362,73 +371,76 @@ public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-ceil */ - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -437,73 +449,76 @@ public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function minute-ceil */ - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -513,73 +528,76 @@ public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function SECOND-ceil */ - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_ceil", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_ceil", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(hasVarArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_ceil", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), @@ -589,73 +607,76 @@ public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function year-floor */ - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "year_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "year_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -664,73 +685,76 @@ public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function month-floor */ - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "month_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "month_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), @@ -740,73 +764,76 @@ public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function day-floor */ - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "day_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "day_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -815,73 +842,76 @@ public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-floor */ - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "hour_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "hour_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -890,73 +920,76 @@ public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function minute-floor */ - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "minute_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "minute_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -966,73 +999,76 @@ public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral peri /** * datetime arithmetic function SECOND-floor */ - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(varArgs = false, name = "second_floor", + argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_floor", + argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(hasVarArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(varArgs = false, name = "second_floor", + argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Field.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Field.java index ea454178c7cc56..25bee5e40a4dc1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Field.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Field.java @@ -50,19 +50,21 @@ public class Field extends ScalarFunction implements ExplicitlyCastableSignature, PropagateNullable { public static final List SIGNATURES = ImmutableList.of( - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(TinyIntType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(SmallIntType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(IntegerType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(BigIntType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(LargeIntType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(FloatType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DoubleType.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DecimalV2Type.SYSTEM_DEFAULT), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DecimalV3Type.WILDCARD), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DateV2Type.INSTANCE), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DateTimeV2Type.SYSTEM_DEFAULT), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(VarcharType.SYSTEM_DEFAULT), - FunctionSignature.ret(IntegerType.INSTANCE).varArgs(StringType.INSTANCE) + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(TinyIntType.INSTANCE, TinyIntType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(SmallIntType.INSTANCE, SmallIntType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(IntegerType.INSTANCE, IntegerType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(BigIntType.INSTANCE, BigIntType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(LargeIntType.INSTANCE, LargeIntType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(FloatType.INSTANCE, FloatType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DoubleType.INSTANCE, DoubleType.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE) + .varArgs(DecimalV2Type.SYSTEM_DEFAULT, DecimalV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DecimalV3Type.WILDCARD, DecimalV3Type.WILDCARD), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(DateV2Type.INSTANCE, DateV2Type.INSTANCE), + FunctionSignature.ret(IntegerType.INSTANCE) + .varArgs(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT), + FunctionSignature.ret(IntegerType.INSTANCE).varArgs(StringType.INSTANCE, StringType.INSTANCE) ); /** From 1d6be61e9d7e74155cd7a5454af9cfe3e5cd5121 Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Sat, 7 Sep 2024 12:11:52 +0800 Subject: [PATCH 5/8] fix p0 regression and add more tests --- .../rules/FoldConstantRuleOnFE.java | 3 + .../expressions/ExpressionEvaluator.java | 4 +- .../executable/StringArithmetic.java | 388 ++++-------------- .../ArrayContainsToArrayOverlapTest.java | 5 +- .../doris/regression/suite/Suite.groovy | 14 + .../fold_constant/fold_constant_by_be.groovy | 171 -------- .../fold_constant_string_arithmatic.groovy | 378 +++++++++++++++++ 7 files changed, 475 insertions(+), 488 deletions(-) create mode 100644 regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java index fdd3b02e6fd483..85002373f81812 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java @@ -91,6 +91,7 @@ import com.google.common.collect.Lists; import org.apache.commons.codec.digest.DigestUtils; +import java.time.DateTimeException; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -435,6 +436,8 @@ public Expression visitCast(Cast cast, ExpressionRewriteContext context) { // If cast is from type coercion, we don't use NULL literal and will throw exception. throw t; } + } catch (DateTimeException e) { + return new NullLiteral(dataType); } } try { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java index b10aa4de020971..f3d471b2abedc4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java @@ -111,7 +111,9 @@ private Expression invoke(Expression expression, String fnName, DataType[] args) Class componentType = parameterType.getComponentType(); Object varArgs = Array.newInstance(componentType, totalSize - fixedArgsSize); for (int i = fixedArgsSize; i < totalSize; i++) { - Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); + if (!(expression.children().get(i) instanceof NullLiteral)) { + Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); + } } Object[] objects = new Object[fixedArgsSize + 1]; for (int i = 0; i < fixedArgsSize; i++) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index cd094a228382c1..1e239839073707 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -29,7 +29,6 @@ import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; import org.apache.doris.nereids.trees.expressions.literal.FloatLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; -import org.apache.doris.nereids.trees.expressions.literal.JsonLiteral; import org.apache.doris.nereids.trees.expressions.literal.LargeIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; @@ -38,9 +37,6 @@ import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; -import org.json.JSONArray; -import org.json.JSONObject; - import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URI; @@ -50,7 +46,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.Base64; import java.util.List; /** @@ -81,18 +76,18 @@ public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLit return new VarcharLiteral(""); } else if (second.getValue() < 0) { leftIndex = stringLength + second.getValue(); - } else if (second.getValue() < stringLength) { - leftIndex = second.getValue(); + } else if (second.getValue() <= stringLength) { + leftIndex = second.getValue() - 1; } else { return new VarcharLiteral(""); } int rightIndex = 0; - if (third.getValue() < 0) { + if (third.getValue() <= 0) { return new VarcharLiteral(""); - } else if (third.getValue() > stringLength) { + } else if ((third.getValue() + leftIndex) > stringLength) { rightIndex = stringLength; } else { - rightIndex = third.getValue(); + rightIndex = third.getValue() + leftIndex; } return new VarcharLiteral(first.getValue().substring(leftIndex, rightIndex)); } @@ -176,13 +171,18 @@ public static Expression left(VarcharLiteral first, IntegerLiteral second) { */ @ExecFunction(varArgs = false, name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression right(VarcharLiteral first, IntegerLiteral second) { - if (second.getValue() <= 0) { + if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return new VarcharLiteral(""); - } else if (second.getValue() < first.getValue().length()) { - int length = first.getValue().length(); - return new VarcharLiteral(first.getValue().substring(length - second.getValue(), length)); - } else { + } else if (second.getValue() > first.getValue().length()) { return first; + } else { + if (second.getValue() > 0) { + return new VarcharLiteral(first.getValue().substring( + first.getValue().length() - second.getValue(), first.getValue().length())); + } else { + return new VarcharLiteral(first.getValue().substring( + Math.abs(second.getValue()) - 1, first.getValue().length())); + } } } @@ -191,7 +191,7 @@ public static Expression right(VarcharLiteral first, IntegerLiteral second) { */ @ExecFunction(varArgs = false, name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression locate(VarcharLiteral first, VarcharLiteral second) { - return new IntegerLiteral(first.getValue().strip().indexOf(second.getValue())); + return new IntegerLiteral(second.getValue().strip().indexOf(first.getValue()) + 1); } /** @@ -222,30 +222,6 @@ public static Expression bin(BigIntLiteral first) { return new VarcharLiteral(Long.toBinaryString(first.getValue())); } - /** - * Executable arithmetic functions Hex - */ - @ExecFunction(varArgs = false, name = "hex", argTypes = {"BIGINT"}, returnType = "VARCHAR") - public static Expression hexBigInt(BigIntLiteral first) { - return new VarcharLiteral(Long.toHexString(first.getValue())); - } - - /** - * Executable arithmetic functions Hex - */ - @ExecFunction(varArgs = false, name = "hex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression hexVarchar(VarcharLiteral first) { - return new VarcharLiteral(Long.toHexString(Long.valueOf(first.getValue()))); - } - - /** - * Executable arithmetic functions UnHex - */ - @ExecFunction(varArgs = false, name = "unhex", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression unHexVarchar(VarcharLiteral first) { - return new VarcharLiteral(Long.toBinaryString(Long.valueOf(first.getValue()))); - } - /** * Executable arithmetic functions ConcatWs */ @@ -276,25 +252,6 @@ public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLit return new VarcharLiteral(sb.toString()); } - /** - * Executable arithmetic functions Char - */ - @ExecFunction(varArgs = true, name = "char", argTypes = {"STRING", "INT"}, returnType = "STRING") - public static Expression charStringInt(StringLiteral first, IntegerLiteral... second) { - StringBuilder sb = new StringBuilder(); - for (IntegerLiteral item : second) { - int itemValue = item.getValue(); - byte[] itemBytes = new byte[]{(byte) itemValue}; - try { - String itemString = new String(itemBytes, first.getValue()); - sb.append(itemString); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } - return new StringLiteral(sb.toString()); - } - /** * Executable arithmetic functions CharacterLength */ @@ -303,6 +260,14 @@ public static Expression characterLength(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } + private static boolean isSeparator(char c) { + if (".$|()[{^?*+\\".indexOf(c) == -1) { + return false; + } else { + return true; + } + } + /** * Executable arithmetic functions initCap */ @@ -312,7 +277,7 @@ public static Expression initCap(VarcharLiteral first) { boolean capitalizeNext = true; for (char c : first.getValue().toCharArray()) { - if (Character.isWhitespace(c)) { + if (Character.isWhitespace(c) || isSeparator(c)) { result.append(c); capitalizeNext = true; // Next character should be capitalized } else if (capitalizeNext) { @@ -385,202 +350,6 @@ private static String bytesToHex(byte[] bytes) { return sb.toString(); } - private static Object jsonExtractUnit(JSONObject jsonObject, String unitKey) { - String[] keys = unitKey.replace("$.", "").split("\\."); - Object currentObject = jsonObject; - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - - if (key.endsWith("]")) { // Handle array index access - int arrayStartIndex = key.indexOf('['); - String arrayKey = key.substring(0, arrayStartIndex); - int arrayIndex = Integer.parseInt(key.substring(arrayStartIndex + 1, key.length() - 1)); - - if (currentObject instanceof JSONObject) { - currentObject = ((JSONObject) currentObject).getJSONArray(arrayKey).get(arrayIndex); - } - } else { - if (currentObject instanceof JSONObject) { - currentObject = ((JSONObject) currentObject).get(key); - } - } - } - return currentObject; - } - - private static List jsonExtract(String jsonString, String... jsonPaths) { - List extractedValues = new ArrayList<>(); - JSONObject jsonObject = new JSONObject(jsonString); - - for (String jsonPath : jsonPaths) { - Object currentObject = jsonExtractUnit(jsonObject, jsonPath); - extractedValues.add(currentObject.toString()); - } - - return extractedValues; - } - - /** - * Executable arithmetic functions jsonContains - */ - @ExecFunction(varArgs = true, name = "json_extract", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression jsonExtract(VarcharLiteral first, VarcharLiteral... second) { - StringBuilder sb = new StringBuilder(); - List keys = new ArrayList<>(); - for (VarcharLiteral item : second) { - keys.add(item.getValue()); - } - List extractedValues = jsonExtract(first.getValue(), keys.toArray(new String[0])); - sb.append(extractedValues); - return new VarcharLiteral(sb.toString()); - } - - /** - * Executable arithmetic functions jsonb_extract_string - */ - @ExecFunction(varArgs = false, name = "jsonb_extract_string", argTypes = {"JSON", "VARCHAR"}, returnType = "STRING") - public static Expression jsonbExtractstring(JsonLiteral first, VarcharLiteral second) { - StringBuilder sb = new StringBuilder(); - JSONObject jsonObject = new JSONObject(first.getValue()); - Object currentObject = jsonExtractUnit(jsonObject, second.getValue()); - sb.append(currentObject.toString()); - return new StringLiteral(sb.toString()); - } - - /** - * Checks if a JSON string contains a specific value at a specified path or anywhere in the JSON. - * @param jsonString the input JSON string - * @param value the value to check for - * @param jsonPath (optional) the path to check the value at - * @return true if the JSON contains the value, false otherwise - */ - private static boolean jsonContains(String jsonString, String value, String jsonPath) { - Object jsonObject = null; - // Determine if the input is a JSONArray or JSONObject - if (jsonString.trim().startsWith("[")) { - jsonObject = new JSONArray(jsonString); // Input is a JSONArray - } else { - jsonObject = new JSONObject(jsonString); - } - - if (!jsonPath.equals("$")) { - // If a JSON path is provided, search at that specific path - String[] keys = jsonPath.replace("$.", "").split("\\."); - Object currentObject = jsonObject; - - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - - if (key.endsWith("]")) { // Handle array index access - int arrayStartIndex = key.indexOf('['); - String arrayKey = key.substring(0, arrayStartIndex); - int arrayIndex = Integer.parseInt(key.substring(arrayStartIndex + 1, key.length() - 1)); - - if (currentObject instanceof JSONObject) { - JSONArray jsonArray = ((JSONObject) currentObject).getJSONArray(arrayKey); - if (i == keys.length - 1) { - // At the last key in the path, check if the value matches the array element - return jsonArray.get(arrayIndex).toString().equals(value); - } else { - currentObject = jsonArray.get(arrayIndex); - } - } - } else { - if (currentObject instanceof JSONObject) { - if (!((JSONObject) currentObject).has(key)) { - return false; - } - currentObject = ((JSONObject) currentObject).get(key); - } - } - } - return currentObject.toString().equals(value); - } else { - // If no JSON path is provided, search for the value anywhere in the JSON - return jsonContainsAnywhere(jsonObject, value); - } - } - - /** - * Recursively checks if the value exists anywhere in the JSON object. - * @param jsonObject the input JSONObject - * @param value the value to check for - * @return true if the value is found, false otherwise - */ - private static boolean jsonContainsAnywhere(Object jsonObject, String value) { - if (jsonObject.toString().equals(value)) { - return true; - } - if (jsonObject instanceof JSONObject) { - JSONObject json = (JSONObject) jsonObject; - for (String key : json.keySet()) { - Object currentValue = json.get(key); - if (jsonContainsAnywhere(currentValue, value)) { - return true; - } - } - } else if (jsonObject instanceof JSONArray) { - JSONArray jsonArray = (JSONArray) jsonObject; - for (int i = 0; i < jsonArray.length(); i++) { - if (jsonContainsAnywhere(jsonArray.get(i), value)) { - return true; - } - } - } else { - return jsonObject.toString().equals(value); - } - return false; - } - - /** - * Executable arithmetic functions jsonContains - */ - @ExecFunction(varArgs = false, name = "json_contains", - argTypes = {"JSON", "JSON", "STRING"}, returnType = "BOOLEAN") - public static Expression jsonContainsString(JsonLiteral first, JsonLiteral second, StringLiteral third) { - if (jsonContains(first.getValue(), second.getValue(), third.getValue())) { - return BooleanLiteral.TRUE; - } else { - return BooleanLiteral.FALSE; - } - } - - /** - * Executable arithmetic functions jsonContains - */ - @ExecFunction(varArgs = false, name = "json_length", argTypes = {"JSON", "VARCHAR"}, returnType = "INT") - public static Expression jsonLengthVarchar(JsonLiteral first, VarcharLiteral second) { - if (second.getValue().equals("$")) { - return new IntegerLiteral(first.getValue().length()); - } - Object jsonObject = null; - // Determine if the input is a JSONArray or JSONObject - if (second.getValue().trim().startsWith("[")) { - jsonObject = new JSONArray(second.getValue()); // Input is a JSONArray - } else { - jsonObject = new JSONObject(second.getValue()); - } - return new IntegerLiteral(jsonObject.toString().length()); - } - - /** - * Executable arithmetic functions jsonContains - */ - @ExecFunction(varArgs = false, name = "json_length", argTypes = {"JSON", "STRING"}, returnType = "INT") - public static Expression jsonLengthString(JsonLiteral first, StringLiteral second) { - if (second.getValue().equals("$")) { - return new IntegerLiteral(first.getValue().length()); - } - Object jsonObject = null; - // Determine if the input is a JSONArray or JSONObject - if (second.getValue().trim().startsWith("[")) { - jsonObject = new JSONArray(second.getValue()); // Input is a JSONArray - } else { - jsonObject = new JSONObject(second.getValue()); - } - return new IntegerLiteral(jsonObject.toString().length()); - } - private static int compareLiteral(Literal first, Literal... second) { for (int i = 0; i < second.length; i++) { if (second[i].getValue().equals(first.getValue())) { @@ -768,8 +537,8 @@ public static Expression space(IntegerLiteral first) { * Executable arithmetic functions split_by_char */ @ExecFunction(varArgs = false, name = "split_by_char", - argTypes = {"STRING", "STRING"}, returnType = "ARRAY") - public static Expression splitByChar(StringLiteral first, StringLiteral second) { + argTypes = {"VARCHAR", "VARCHAR"}, returnType = "ARRAY") + public static Expression splitByChar(VarcharLiteral first, VarcharLiteral second) { String[] result = first.getValue().split(second.getValue()); List items = new ArrayList<>(); for (int i = 1; i < result.length; i++) { @@ -798,11 +567,39 @@ public static Expression splitByString(StringLiteral first, StringLiteral second @ExecFunction(varArgs = false, name = "split_part", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { - String[] parts = literal.getValue().split(chr.getValue()); - if (parts.length < number.getValue() || number.getValue() < (- parts.length) || number.getValue() == 0) { - return new VarcharLiteral(""); + if (literal.getValue().equals(chr.getValue())) { + if (Math.abs(number.getValue()) == 1 || Math.abs(number.getValue()) == 2) { + return new VarcharLiteral(""); + } + } + String separator = chr.getValue(); + String[] parts = null; + if (number.getValue() < 0) { + StringBuilder sb = new StringBuilder(literal.getValue()); + StringBuilder seperatorBuilder = new StringBuilder(separator); + separator = seperatorBuilder.reverse().toString(); + if (".$|()[{^?*+\\".indexOf(separator) != -1 || separator.startsWith("\\")) { + separator = "\\" + separator; + } + parts = sb.reverse().toString().split(separator); + } else { + if (".$|()[{^?*+\\".indexOf(separator) != -1 || separator.startsWith("\\")) { + separator = "\\" + separator; + } + parts = literal.getValue().split(separator); + } + + if (parts.length < Math.abs(number.getValue()) || number.getValue() == 0) { + if (parts.length == Math.abs(number.getValue()) - 1) { + if (number.getValue() < 0 && literal.getValue().startsWith(chr.getValue()) + || number.getValue() > 0 && literal.getValue().endsWith(chr.getValue())) { + return new VarcharLiteral(""); + } + } + return new NullLiteral(); } else if (number.getValue() < 0) { - return new VarcharLiteral(parts[parts.length + number.getValue()]); + StringBuilder result = new StringBuilder(parts[Math.abs(number.getValue()) - 1]); + return new VarcharLiteral(result.reverse().toString()); } else { return new VarcharLiteral(parts[number.getValue() - 1]); } @@ -815,6 +612,9 @@ public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, I argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { String[] parts = literal.getValue().split(chr.getValue()); + if (Math.abs(number.getValue()) >= parts.length) { + return literal; + } int leftIndex; int rightIndex; if (parts.length < number.getValue() || number.getValue() < (- parts.length) || number.getValue() == 0) { @@ -840,10 +640,13 @@ public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral c */ @ExecFunction(varArgs = false, name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { - if (first.getValue().equals(second.getValue())) { - return new TinyIntLiteral((byte) 1); - } else { + int result = first.getValue().compareTo(second.getValue()); + if (result == 0) { return new TinyIntLiteral((byte) 0); + } else if (result < 0) { + return new TinyIntLiteral((byte) -1); + } else { + return new TinyIntLiteral((byte) 1); } } @@ -866,13 +669,18 @@ public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { */ @ExecFunction(varArgs = false, name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { - if (second.getValue() <= 0) { + if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return new VarcharLiteral(""); } else if (second.getValue() > first.getValue().length()) { return first; } else { - return new VarcharLiteral(first.getValue().substring( + if (second.getValue() > 0) { + return new VarcharLiteral(first.getValue().substring( first.getValue().length() - second.getValue(), first.getValue().length())); + } else { + return new VarcharLiteral(first.getValue().substring( + Math.abs(second.getValue()) - 1, first.getValue().length())); + } } } @@ -885,7 +693,7 @@ public static Expression overlay(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third, VarcharLiteral four) { StringBuilder sb = new StringBuilder(); if (second.getValue() <= 0 || second.getValue() > first.getValue().length()) { - return new VarcharLiteral(""); + return first; } else { if (third.getValue() < 0 || third.getValue() > (first.getValue().length() - third.getValue())) { sb.append(first.getValue().substring(0, second.getValue() - 1)); @@ -968,38 +776,6 @@ public static Expression urlDecode(VarcharLiteral first) { } } - /** - * Executable arithmetic functions decodeasvarchar - */ - @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"SMALLINT"}, returnType = "VARCHAR") - public static Expression decodeasvarcharSmallint(SmallIntLiteral first) { - return new VarcharLiteral(first.getValue().toString()); - } - - /** - * Executable arithmetic functions decodeasvarchar - */ - @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"INT"}, returnType = "VARCHAR") - public static Expression decodeasvarcharInt(IntegerLiteral first) { - return new VarcharLiteral(first.getValue().toString()); - } - - /** - * Executable arithmetic functions decodeasvarchar - */ - @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"BIGINT"}, returnType = "VARCHAR") - public static Expression decodeasvarcharBigint(BigIntLiteral first) { - return new VarcharLiteral(first.getValue().toString()); - } - - /** - * Executable arithmetic functions decodeasvarchar - */ - @ExecFunction(varArgs = false, name = "decode_as_varchar", argTypes = {"LARGEINT"}, returnType = "VARCHAR") - public static Expression decodeasvarcharLargeint(LargeIntLiteral first) { - return new VarcharLiteral(first.getValue().toString()); - } - /** * Executable arithmetic functions append_trailing_char_if_absent */ @@ -1058,18 +834,6 @@ public static Expression quote(VarcharLiteral first) { return new VarcharLiteral("\'" + first.getValue() + "\'"); } - /** - * Executable arithmetic functions toBase64 - */ - @ExecFunction(varArgs = false, name = "to_base64", argTypes = {"STRING"}, returnType = "STRING") - public static Expression toBase64(VarcharLiteral first) { - // Convert the string to bytes - byte[] strBytes = first.getValue().getBytes(); - // Encode the bytes to Base64 - String encodedStr = Base64.getEncoder().encodeToString(strBytes); - return new VarcharLiteral(encodedStr); - } - /** * Executable arithmetic functions replaceEmpty */ diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ArrayContainsToArrayOverlapTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ArrayContainsToArrayOverlapTest.java index 1ef76c14347148..028d85ce097fe6 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ArrayContainsToArrayOverlapTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ArrayContainsToArrayOverlapTest.java @@ -19,7 +19,6 @@ import org.apache.doris.nereids.rules.expression.ExpressionRewriteTestHelper; import org.apache.doris.nereids.trees.expressions.And; -import org.apache.doris.nereids.trees.expressions.EqualTo; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.Or; import org.apache.doris.nereids.trees.expressions.functions.scalar.ArraysOverlap; @@ -74,9 +73,7 @@ void testAndOther() { .getPlan(); Expression expression = plan.child(0).getExpressions().get(0).child(0); Assertions.assertTrue(expression instanceof Or); - Assertions.assertTrue(expression.child(0) instanceof Or); - Assertions.assertTrue(expression.child(0).child(0) instanceof ArraysOverlap); - Assertions.assertTrue(expression.child(0).child(1) instanceof EqualTo); + Assertions.assertTrue(expression.child(0) instanceof ArraysOverlap); Assertions.assertTrue(expression.child(1) instanceof And); } diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy index 713a30e98ca076..c7e195224e4ec0 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy @@ -1378,6 +1378,20 @@ class Suite implements GroovyInterceptable { Assert.assertEquals("FINISHED", result) } + void testFoldConst(String foldSql) { + String openFoldConstant = "set debug_skip_fold_constant=false"; + sql(openFoldConstant) + logger.info(foldSql) + List> resultByFoldConstant = sql(foldSql) + logger.info("result by fold constant: " + resultByFoldConstant.toString()) + String closeFoldConstant = "set debug_skip_fold_constant=true"; + sql(closeFoldConstant) + logger.info(foldSql) + List> resultExpected = sql(foldSql) + logger.info("result expected: " + resultExpected.toString()) + Assert.assertEquals(resultExpected, resultByFoldConstant) + } + String getJobName(String dbName, String mtmvName) { String showMTMV = "select JobName from mv_infos('database'='${dbName}') where Name = '${mtmvName}'"; logger.info(showMTMV) diff --git a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_by_be.groovy b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_by_be.groovy index 88ce62deae6a79..be5aa94b7f60c8 100644 --- a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_by_be.groovy +++ b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_by_be.groovy @@ -52,175 +52,4 @@ suite("fold_constant_by_be") { } sql 'set query_timeout=12;' -// qt_sql "select sleep(sign(1)*5);" - - qt_select1 """ explain SELECT Concat('Hello', ' ', 'World')""" - qt_select2 """ explain SELECT Substring('Hello World', 1, 5)""" - qt_select3 """ explain SELECT Length('Hello World')""" - qt_select4 """ explain SELECT Lower('Hello World')""" - qt_select5 """ explain SELECT Upper('Hello World')""" - qt_select6 """ explain SELECT Trim(' Hello World ')""" - qt_select7 """ explain SELECT Ltrim(' Hello World ')""" - qt_select8 """ explain SELECT Rtrim(' Hello World ')""" - qt_select9 """ explain SELECT Replace('Hello World', 'World', 'Everyone')""" - qt_select10 """ explain SELECT Left('Hello World', 5)""" - qt_select11 """ explain SELECT Right('Hello World', 5)""" - qt_select12 """ explain SELECT Locate('World', 'Hello World')""" - qt_select13 """ explain SELECT Instr('Hello World', 'World')""" - qt_select14 """ explain SELECT Ascii('A')""" - qt_select15 """ explain SELECT Bin(5)""" - qt_select16 """ explain SELECT Hex(255)""" - qt_select17 """ explain SELECT Unhex('FF')""" - qt_select18 """ explain SELECT Concat_Ws('-', '2024', '09', '02')""" - qt_select19 """ explain SELECT Char(65)""" - qt_select20 """ explain SELECT Character_Length('Hello World')""" - qt_select21 """ explain SELECT Initcap('hello world')""" - qt_select22 """ explain SELECT Md5('Hello World')""" - qt_select23 """ explain SELECT Md5Sum('Hello World')""" -// qt_select24 """ explain SELECT JsonExtract('{"key": "value"}', '$.key')""" -// qt_select25 """ explain SELECT JsonbExtractString('{"key": "value"}', '$.key')""" -// qt_select26 """ explain SELECT JsonContains('{"key": "value"}', '"key"')""" -// qt_select27 """ explain SELECT JsonLength('{"key1": "value1", "key2": "value2"}')""" -// qt_select28 """ explain SELECT JsonObject('key', 'value')""" -// qt_select29 """ explain SELECT JsonArray('value1', 'value2')""" -// qt_select30 """ explain SELECT JsonKeys('{"key1": "value1", "key2": "value2"}')""" -// qt_select31 """ explain SELECT JsonInsert('{"key1": "value1"}', '$.key2', 'value2')""" -// qt_select32 """ explain SELECT JsonReplace('{"key1": "value1"}', '$.key1', 'new_value')""" -// qt_select33 """ explain SELECT JsonSet('{"key1": "value1"}', '$.key2', 'value2')""" - qt_select34 """ explain SELECT Json_Quote('Hello World')""" - qt_select35 """ explain SELECT Json_UnQuote('"Hello World"')""" - qt_select36 """ explain SELECT Field('b', 'a', 'b', 'c')""" - qt_select37 """ explain SELECT Find_In_Set('b', 'a,b,c')""" - qt_select38 """ explain SELECT Repeat('Hello', 3)""" - qt_select39 """ explain SELECT Reverse('Hello')""" - qt_select40 """ explain SELECT Space(5)""" - qt_select41 """ explain SELECT Split_By_Char(',', 'a,b,c')""" - qt_select42 """ explain SELECT Split_By_String('::', 'a::b::c')""" - qt_select43 """ explain SELECT Split_Part('a,b,c', ',', 2)""" - qt_select44 """ explain SELECT Substring_Index('a,b,c', ',', 2)""" - qt_select45 """ explain SELECT Strcmp('abc', 'abd')""" - qt_select46 """ explain SELECT StrLeft('Hello World', 5)""" - qt_select47 """ explain SELECT StrRight('Hello World', 5)""" - qt_select48 """ explain SELECT Overlay('abcdef', '123', 3, 2)""" - qt_select49 """ explain SELECT Parse_Url('http://www.example.com/path?query=abc', 'HOST')""" - qt_select50 """ explain SELECT Url_Decode('%20Hello%20World%20')""" - qt_select51 """ explain SELECT Regexp_Extract('abc123xyz', '\\d+', 0)""" - qt_select52 """ explain SELECT Regexp_Extract_All('abc123xyz456', '\\d+')""" - qt_select53 """ explain SELECT Regexp_Replace('abc123xyz', '\\d+', '000')""" - qt_select54 """ explain SELECT Regexp_Replace_One('abc123xyz123', '\\d+', '000')""" - qt_select55 """ explain SELECT Decode_As_Varchar(65)""" - qt_select56 """ explain SELECT Encode_As_BigInt('123456789')""" - qt_select57 """ explain SELECT Encode_As_Int('12345')""" - qt_select58 """ explain SELECT Encode_As_LargeInt('9223372036854775807')""" - qt_select59 """ explain SELECT Encode_As_SmallInt('32767')""" - - // Substring with negative start index - // Expected behavior: Depending on the SQL engine, might return an empty string or error. - qt_select """SELECT Substring('Hello World', -1, 5)""" - - // Substring with length exceeding the string length - // Expected behavior: Return 'Hello' as the length exceeds the string length. - qt_select """SELECT Substring('Hello', 1, 10)""" - - // Left with length greater than string length - // Expected behavior: Return 'Hello'. - qt_select """SELECT Left('Hello', 10)""" - - // Right with length greater than string length - // Expected behavior: Return 'Hello'. - qt_select """SELECT Right('Hello', 10)""" - - // SplitPart with part number greater than the number of parts - // Expected behavior: Return an empty string or error. - qt_select """SELECT Split_Part('a,b,c', ',', 5)""" - - // SplitPart with negative part number - // Expected behavior: Return an empty string or error. - qt_select """SELECT Split_Part('a,b,c', ',', -1)""" - - // Locate with the substring not present - // Expected behavior: Return 0 as 'World' is not found. - qt_select """SELECT Locate('World', 'Hello')""" - - // Instr with the substring not present - // Expected behavior: Return 0 as 'World' is not found. - qt_select """SELECT Instr('Hello', 'World')""" - - // Replace with an empty search string - // Expected behavior: Some SQL engines may treat this as a no-op, others might throw an error. - qt_select """SELECT Replace('Hello World', '', 'Everyone')""" - - // Replace with an empty replacement string - // Expected behavior: Return 'Hello '. - qt_select """SELECT Replace('Hello World', 'World', '')""" - - // Concat with NULL values - // Expected behavior: Depending on the SQL engine, may return 'HelloWorld' or NULL. - qt_select """SELECT Concat('Hello', NULL, 'World')""" - - // Ltrim with a string that has no leading spaces - // Expected behavior: Return 'Hello'. - qt_select """SELECT Ltrim('Hello')""" - - // Rtrim with a string that has no trailing spaces - // Expected behavior: Return 'Hello'. - qt_select """SELECT Rtrim('Hello')""" - - // JsonExtract with an invalid JSON path - // Expected behavior: Return NULL or an empty string. -// qt_select """SELECT Json_Extract('{"key": "value"}', '$.invalid')""" - - // JsonLength with a non-JSON string - // Expected behavior: Return NULL or error. - qt_select """SELECT Json_Length('Hello World')""" - - // Field with a value not present in the list - // Expected behavior: Return 0 as 'd' is not found. - qt_select """SELECT Field('d', 'a', 'b', 'c')""" - - // FindInSet with a value not present in the set - // Expected behavior: Return 0 as 'd' is not found. - qt_select """SELECT Find_In_Set('d', 'a,b,c')""" - - // Repeat with a negative repeat count - // Expected behavior: Return an empty string or error. - qt_select """SELECT Repeat('Hello', -3)""" - - // Space with a negative number of spaces - // Expected behavior: Return an empty string or error. - qt_select """SELECT Space(-5)""" - - // SplitByChar with a delimiter not present in the string - // Expected behavior: Return the original string in a single element array. - qt_select """explain SELECT Split_By_Char(',', 'abc')""" - - // SplitByString with a delimiter not present in the string - // Expected behavior: Return the original string in a single element array. - qt_select """SELECT Split_By_String('::', 'abc')""" - - // Strcmp with two identical strings - // Expected behavior: Return 0 as the strings are equal. - qt_select """SELECT Strcmp('abc', 'abc')""" - - // Strcmp with a null string - // Expected behavior: Return NULL or -1 depending on the SQL engine. - qt_select """SELECT Strcmp('abc', NULL)""" - - // Hex with a negative number - // Expected behavior: Return the hexadecimal representation of the two's complement, or an error depending on the SQL engine. - qt_select """SELECT Hex(-255)""" - - // Unhex with an invalid hexadecimal string - // Expected behavior: Return NULL or error as 'GHIJ' is not a valid hex string. - qt_select """SELECT Unhex('GHIJ')""" - - // JsonReplace with a path that does not exist - // Expected behavior: Depending on the engine, might return the original JSON or an error. -// qt_select """SELECT Json_Replace('{"key": "value"}', '$.nonexistent', 'new_value')""" - - // UrlDecode with an invalid percent-encoded string - // Expected behavior: Return NULL or error due to invalid encoding. - qt_select """SELECT Url_Decode('%ZZHello%20World')""" - - } diff --git a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy new file mode 100644 index 00000000000000..d621d3d8435529 --- /dev/null +++ b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy @@ -0,0 +1,378 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +suite("fold_constant_string_arithmatic") { + def db = "fold_constant_string_arithmatic" + sql "create database if not exists ${db}" + + sql "set enable_nereids_planner=true" + sql "set enable_fallback_to_original_planner=false" + sql "set enable_fold_constant_by_be=false" + + testFoldConst("SELECT Concat('Hello', ' ', 'World')") + testFoldConst("SELECT Substring('Hello World', 1, 5)") + testFoldConst("SELECT Substring('1', 1, 1)") + testFoldConst("select 100, 'abc', substring('abc', 1, 2), substring(substring('abcdefg', 4, 3), 1, 2), null") + testFoldConst("SELECT Length('Hello World')") + testFoldConst("SELECT Lower('Hello World')") + testFoldConst("SELECT Upper('Hello World')") + testFoldConst("SELECT Trim(' Hello World ')") + testFoldConst("SELECT Ltrim(' Hello World ')") + testFoldConst("SELECT Rtrim(' Hello World ')") + testFoldConst("SELECT Replace('Hello World', 'World', 'Everyone')") + testFoldConst("SELECT Left('Hello World', 5)") + testFoldConst("SELECT Right('Hello World', 5)") + testFoldConst("SELECT Locate('World', 'Hello World')") + testFoldConst("SELECT Instr('Hello World', 'World')") + testFoldConst("SELECT Ascii('A')") + testFoldConst("SELECT Bin(5)") + testFoldConst("SELECT Hex(255)") + testFoldConst("SELECT Unhex('FF')") + testFoldConst("SELECT Concat_Ws('-', '2024', '09', '02')") + testFoldConst("SELECT Char(65)") + testFoldConst("SELECT Character_Length('Hello World')") + testFoldConst("SELECT Initcap('hello world')") + testFoldConst("SELECT Md5('Hello World')") + testFoldConst("SELECT Md5Sum('Hello World')") +// testFoldConst("SELECT JsonExtract('{"key": "value"}', '$.key')") +// testFoldConst("SELECT JsonbExtractString('{"key": "value"}', '$.key')") +// testFoldConst("SELECT JsonContains('{"key": "value"}', '"key"')") +// testFoldConst("SELECT JsonLength('{"key1": "value1", "key2": "value2"}')") +// testFoldConst("SELECT JsonObject('key', 'value')") +// testFoldConst("SELECT JsonArray('value1', 'value2')") +// testFoldConst("SELECT JsonKeys('{"key1": "value1", "key2": "value2"}')") +// testFoldConst("SELECT JsonInsert('{"key1": "value1"}', '$.key2', 'value2')") +// testFoldConst("SELECT JsonReplace('{"key1": "value1"}', '$.key1', 'new_value')") +// testFoldConst("SELECT JsonSet('{"key1": "value1"}', '$.key2', 'value2')") +// testFoldConst("SELECT Json_Quote('Hello World')") +// testFoldConst("SELECT Json_UnQuote('"Hello World"')") + testFoldConst("SELECT Field('b', 'a', 'b', 'c')") + testFoldConst("SELECT Find_In_Set('b', 'a,b,c')") + testFoldConst("SELECT Repeat('Hello', 3)") + testFoldConst("SELECT Reverse('Hello')") + testFoldConst("SELECT length(Space(10))") +// testFoldConst("SELECT Split_By_Char('a,b,c',',')") has bug in be execution + testFoldConst("SELECT Split_By_String('a::b::c', '::')") + testFoldConst("SELECT Split_Part('a,b,c', ',', 2)") + testFoldConst("SELECT Substring_Index('a,b,c', ',', 2)") + testFoldConst("SELECT Strcmp('abc', 'abd')") + testFoldConst("SELECT StrLeft('Hello World', 5)") + testFoldConst("SELECT StrRight('Hello World', 5)") + testFoldConst("SELECT Overlay('abcdef', '123', 3, 2)") + testFoldConst("SELECT Parse_Url('http://www.example.com/path?query=abc', 'HOST')") + testFoldConst("SELECT Url_Decode('%20Hello%20World%20')") + + // Substring with negative start index + // Expected behavior: Depending on the SQL engine, might return an empty string or error. + testFoldConst("SELECT Substring('Hello World', -1, 5)") + + // Substring with length exceeding the string length + // Expected behavior: Return 'Hello' as the length exceeds the string length. + testFoldConst("SELECT Substring('Hello', 1, 10)") + + // Left with length greater than string length + // Expected behavior: Return 'Hello'. + testFoldConst("SELECT Left('Hello', 10)") + + // Right with length greater than string length + // Expected behavior: Return 'Hello'. + testFoldConst("SELECT Right('Hello', 10)") + + // SplitPart with part number greater than the number of parts + // Expected behavior: Return an empty string or error. + testFoldConst("SELECT Split_Part('a,b,c', ',', 5)") + + // SplitPart with negative part number + // Expected behavior: Return an empty string or error. + testFoldConst("SELECT Split_Part('a,b,c', ',', -1)") + + // Locate with the substring not present + // Expected behavior: Return 0 as 'World' is not found. + testFoldConst("SELECT Locate('World', 'Hello')") + + // Instr with the substring not present + // Expected behavior: Return 0 as 'World' is not found. + testFoldConst("SELECT Instr('Hello', 'World')") + + // Replace with an empty search string + // Expected behavior: Some SQL engines may treat this as a no-op, others might throw an error. + testFoldConst("SELECT Replace('Hello World', '', 'Everyone')") + + // Replace with an empty replacement string + // Expected behavior: Return 'Hello '. + testFoldConst("SELECT Replace('Hello World', 'World', '')") + + // Concat with NULL values + // Expected behavior: Depending on the SQL engine, may return 'HelloWorld' or NULL. + testFoldConst("SELECT Concat('Hello', NULL, 'World')") + + // Ltrim with a string that has no leading spaces + // Expected behavior: Return 'Hello'. + testFoldConst("SELECT Ltrim('Hello')") + + // Rtrim with a string that has no trailing spaces + // Expected behavior: Return 'Hello'. + testFoldConst("SELECT Rtrim('Hello')") + + // JsonExtract with an invalid JSON path + // Expected behavior: Return NULL or an empty string. +// testFoldConst("SELECT Json_Extract('{"key": "value"}', '$.invalid')") + + // JsonLength with a non-JSON string + // Expected behavior: Return NULL or error. + testFoldConst("SELECT Json_Length('Hello World')") + + // Field with a value not present in the list + // Expected behavior: Return 0 as 'd' is not found. + testFoldConst("SELECT Field('d', 'a', 'b', 'c')") + + // FindInSet with a value not present in the set + // Expected behavior: Return 0 as 'd' is not found. + testFoldConst("SELECT Find_In_Set('d', 'a,b,c')") + + // Repeat with a negative repeat count + // Expected behavior: Return an empty string or error. + testFoldConst("SELECT Repeat('Hello', -3)") + + // Space with a negative number of spaces + // Expected behavior: Return an empty string or error. + testFoldConst("SELECT Space(-5)") + + // SplitByChar with a delimiter not present in the string + // Expected behavior: Return the original string in a single element array. +// testFoldConst("SELECT Split_By_Char('abc', ',')") + + // SplitByString with a delimiter not present in the string + // Expected behavior: Return the original string in a single element array. + testFoldConst("SELECT Split_By_String('::', 'abc')") + + // Strcmp with two identical strings + // Expected behavior: Return 0 as the strings are equal. + testFoldConst("SELECT Strcmp('abc', 'abc')") + + // Strcmp with a null string + // Expected behavior: Return NULL or -1 depending on the SQL engine. + testFoldConst("SELECT Strcmp('abc', NULL)") + + // Hex with a negative number + // Expected behavior: Return the hexadecimal representation of the two's complement, or an error depending on the SQL engine. + testFoldConst("SELECT Hex(-255)") + + // Unhex with an invalid hexadecimal string + // Expected behavior: Return NULL or error as 'GHIJ' is not a valid hex string. + testFoldConst("SELECT Unhex('GHIJ')") + + // JsonReplace with a path that does not exist + // Expected behavior: Depending on the engine, might return the original JSON or an error. +// testFoldConst("SELECT Json_Replace('{"key": "value"}', '$.nonexistent', 'new_value')") + + // UrlDecode with an invalid percent-encoded string + // Expected behavior: Return NULL or error due to invalid encoding. + testFoldConst("SELECT Url_Decode('%ZZHello%20World')") + + testFoldConst("select elt(0, \"hello\", \"doris\")") + testFoldConst("select elt(1, \"hello\", \"doris\")") + testFoldConst("select elt(2, \"hello\", \"doris\")") + testFoldConst("select elt(3, \"hello\", \"doris\")") + testFoldConst("select c1, c2, elt(c1, c2) from (select number as c1, 'varchar' as c2 from numbers('number'='5') where number > 0) a") + + testFoldConst("select append_trailing_char_if_absent('a','c')") + testFoldConst("select append_trailing_char_if_absent('ac','c')") + + testFoldConst("select ascii('1')") + testFoldConst("select ascii('a')") + testFoldConst("select ascii('A')") + testFoldConst("select ascii('!')") + + testFoldConst("select bit_length(\"abc\")") + + testFoldConst("select char_length(\"abc\")") + + testFoldConst("select concat(\"a\", \"b\")") + testFoldConst("select concat(\"a\", \"b\", \"c\")") + testFoldConst("select concat(\"a\", null, \"c\")") + + testFoldConst("select concat_ws(\"or\", \"d\", \"is\")") + testFoldConst("select concat_ws(NULL, \"d\", \"is\")") + testFoldConst("select concat_ws(\"or\", \"d\", NULL,\"is\")") + testFoldConst("select concat_ws(\"or\", [\"d\", \"is\"])") + testFoldConst("select concat_ws(NULL, [\"d\", \"is\"])") + testFoldConst("select concat_ws(\"or\", [\"d\", NULL,\"is\"])") + testFoldConst("select concat_ws(\"or\", [\"d\", \"\",\"is\"])") + + testFoldConst("select ends_with(\"Hello doris\", \"doris\")") + testFoldConst("select ends_with(\"Hello doris\", \"Hello\")") + + testFoldConst("select find_in_set(\"b\", \"a,b,c\")") + testFoldConst("select find_in_set(\"d\", \"a,b,c\")") + testFoldConst("select find_in_set(null, \"a,b,c\")") + testFoldConst("select find_in_set(\"a\", null)") + + testFoldConst("select hex('1')") + testFoldConst("select hex('12')") + testFoldConst("select hex('@')") + testFoldConst("select hex('A')") + testFoldConst("select hex(12)") + testFoldConst("select hex(-1)") + testFoldConst("select hex('hello,doris')") + + testFoldConst("select unhex('@')") + testFoldConst("select unhex('68656C6C6F2C646F726973')") + testFoldConst("select unhex('41')") + testFoldConst("select unhex('4142')") + testFoldConst("select unhex('')") + testFoldConst("select unhex(NULL)") + + testFoldConst("select instr(\"abc\", \"b\")") + testFoldConst("select instr(\"abc\", \"d\")") + testFoldConst("select instr(\"abc\", null)") + testFoldConst("select instr(null, \"a\")") + testFoldConst("SELECT instr('foobar', '')") + testFoldConst("SELECT instr('上海天津北京杭州', '北京')") + + testFoldConst("SELECT lcase(\"AbC123\")") + testFoldConst("SELECT lower(\"AbC123\")") + + testFoldConst("SELECT initcap(\"AbC123abc abc.abc,?|abc\")") + + testFoldConst("select left(\"Hello doris\",5)") + testFoldConst("select right(\"Hello doris\",5)") + + testFoldConst("select length(\"abc\")") + + testFoldConst("SELECT LOCATE('bar', 'foobarbar')") + testFoldConst("SELECT LOCATE('xbar', 'foobar')") + testFoldConst("SELECT LOCATE('', 'foobar')") + testFoldConst("SELECT LOCATE('北京', '上海天津北京杭州')") + + testFoldConst("SELECT lpad(\"hi\", 5, \"xy\")") + testFoldConst("SELECT lpad(\"hi\", 1, \"xy\")") + testFoldConst("SELECT rpad(\"hi\", 5, \"xy\")") + testFoldConst("SELECT rpad(\"hi\", 1, \"xy\")") + + testFoldConst("SELECT ltrim(' ab d')") + + testFoldConst("select money_format(17014116)") + testFoldConst("select money_format(1123.456)") + testFoldConst("select money_format(1123.4)") + testFoldConst("select money_format(truncate(1000,10))") + + testFoldConst("select null_or_empty(null)") + testFoldConst("select null_or_empty(\"\")") + testFoldConst("select null_or_empty(\"a\")") + + testFoldConst("select not_null_or_empty(null)") + testFoldConst("select not_null_or_empty(\"\")") + testFoldConst("select not_null_or_empty(\"a\")") + + testFoldConst("SELECT repeat(\"a\", 3)") + testFoldConst("SELECT repeat(\"a\", -1)") + testFoldConst("SELECT repeat(\"a\", 0)") + testFoldConst("SELECT repeat(\"a\",null)") + testFoldConst("SELECT repeat(null,1)") + + testFoldConst("select replace(\"https://doris.apache.org:9090\", \":9090\", \"\")") + testFoldConst("select replace(\"https://doris.apache.org:9090\", \"\", \"new_str\")") + + testFoldConst("SELECT REVERSE('hello')") + + testFoldConst("select split_part('hello world', ' ', 1)") + testFoldConst("select split_part('hello world', ' ', 2)") + testFoldConst("select split_part('hello world', ' ', 0)") + testFoldConst("select split_part('hello world', ' ', -1)") + testFoldConst("select split_part('hello world', ' ', -2)") + testFoldConst("select split_part('hello world', ' ', -3)") + testFoldConst("select split_part('abc##123###xyz', '##', 0)") + testFoldConst("select split_part('abc##123###xyz', '##', 1)") + testFoldConst("select split_part('abc##123###xyz', '##', 3)") + testFoldConst("select split_part('abc##123###xyz', '##', 5)") + testFoldConst("select split_part('abc##123###xyz', '##', -1)") + testFoldConst("select split_part('abc##123###xyz', '##', -2)") + testFoldConst("select split_part('abc##123###xyz', '##', -4)") + + testFoldConst("select starts_with(\"hello world\",\"hello\")") + testFoldConst("select starts_with(\"hello world\",\"world\")") + testFoldConst("select starts_with(\"hello world\",null)") + + testFoldConst("select strleft(NULL, 1)") + testFoldConst("select strleft(\"good morning\", NULL)") + testFoldConst("select left(NULL, 1)") + testFoldConst("select left(\"good morning\", NULL)") + testFoldConst("select strleft(\"Hello doris\", 5)") + testFoldConst("select left(\"Hello doris\", 5)") + testFoldConst("select strright(NULL, 1)") + testFoldConst("select strright(\"good morning\", NULL)") + testFoldConst("select right(NULL, 1)") + testFoldConst("select right(\"good morning\", NULL)") + testFoldConst("select strright(\"Hello doris\", 5)") + testFoldConst("select right(\"Hello doris\", 5)") + testFoldConst("select strleft(\"good morning\", 120)") + testFoldConst("select strleft(\"good morning\", -5)") + testFoldConst("select strright(\"Hello doris\", 120)") + testFoldConst("select strright(\"Hello doris\", -5)") + testFoldConst("select left(\"good morning\", 120)") + testFoldConst("select left(\"good morning\", -5)") + testFoldConst("select right(\"Hello doris\", 120)") + testFoldConst("select right(\"Hello doris\", -6)") + + testFoldConst("select substring('abc1', 2)") + testFoldConst("select substring('abc1', -2)") + testFoldConst("select substring('abc1', 5)") + testFoldConst("select substring('abc1def', 2, 2)") + testFoldConst("select substring('abcdef',3,-1)") + testFoldConst("select substring('abcdef',-3,-1)") + testFoldConst("select substring('abcdef',10,1)") + + testFoldConst("select substr('a',3,1)") + testFoldConst("select substr('a',2,1)") + testFoldConst("select substr('a',1,1)") + testFoldConst("select substr('a',0,1)") + testFoldConst("select substr('a',-1,1)") + testFoldConst("select substr('a',-2,1)") + testFoldConst("select substr('a',-3,1)") + testFoldConst("select substr('abcdef',3,-1)") + testFoldConst("select substr('abcdef',-3,-1)") + + testFoldConst("select sub_replace(\"this is origin str\",\"NEW-STR\",1)") + testFoldConst("select sub_replace(\"doris\",\"***\",1,2)") + + testFoldConst("select substring_index(\"hello world\", \" \", 1)") + testFoldConst("select substring_index(\"hello world\", \" \", 2)") + testFoldConst("select substring_index(\"hello world\", \" \", 3)") + testFoldConst("select substring_index(\"hello world\", \" \", -1)") + testFoldConst("select substring_index(\"hello world\", \" \", -2)") + testFoldConst("select substring_index(\"hello world\", \" \", -3)") + testFoldConst("select substring_index(\"prefix__string2\", \"__\", 2)") + testFoldConst("select substring_index(\"prefix__string2\", \"_\", 2)") + testFoldConst("select substring_index(\"prefix_string2\", \"__\", 1)") + testFoldConst("select substring_index(null, \"__\", 1)") + testFoldConst("select substring_index(\"prefix_string\", null, 1)") + testFoldConst("select substring_index(\"prefix_string\", \"_\", null)") + testFoldConst("select substring_index(\"prefix_string\", \"__\", -1)") + + testFoldConst("select elt(0, \"hello\", \"doris\")") + testFoldConst("select elt(1, \"hello\", \"doris\")") + testFoldConst("select elt(2, \"hello\", \"doris\")") + testFoldConst("select elt(3, \"hello\", \"doris\")") + + testFoldConst("select sub_replace(\"this is origin str\",\"NEW-STR\",1)") + testFoldConst("select sub_replace(\"doris\",\"***\",1,2)") + + testFoldConst("select strcmp('a', 'abc')") + testFoldConst("select strcmp('abc', 'abc')") + testFoldConst("select strcmp('abcd', 'abc')") +} From 1245cc2c51dac396fbcc16ccb20cef5d27a1536c Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Tue, 10 Sep 2024 14:54:11 +0800 Subject: [PATCH 6/8] add default value of var args --- .../trees/expressions/ExecFunction.java | 2 +- .../functions/executable/DateTimeAcquire.java | 24 +- .../executable/DateTimeArithmetic.java | 126 ++++--- .../DateTimeExtractAndTransform.java | 281 ++++++++------- .../executable/ExecutableFunctions.java | 27 +- .../executable/NumericArithmetic.java | 174 +++++----- .../executable/StringArithmetic.java | 89 +++-- .../functions/executable/TimeRoundSeries.java | 324 ++++++++---------- 8 files changed, 496 insertions(+), 551 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java index 68163a733c79a3..126449f4b04e34 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExecFunction.java @@ -47,5 +47,5 @@ /** * hasVarArgsc */ - boolean varArgs(); + boolean varArgs() default false; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java index 1bd250454dc11b..17403bd83c0770 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeAcquire.java @@ -36,12 +36,12 @@ public class DateTimeAcquire { /** * date acquire function: now */ - @ExecFunction(varArgs = false, name = "now", argTypes = {}, returnType = "DATETIME") + @ExecFunction(name = "now", argTypes = {}, returnType = "DATETIME") public static Expression now() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(varArgs = false, name = "now", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "now", argTypes = {"INT"}, returnType = "DATETIMEV2") public static Expression now(IntegerLiteral precision) { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone()), precision.getValue()); @@ -50,12 +50,12 @@ public static Expression now(IntegerLiteral precision) { /** * date acquire function: current_timestamp */ - @ExecFunction(varArgs = false, name = "current_timestamp", argTypes = {}, returnType = "DATETIME") + @ExecFunction(name = "current_timestamp", argTypes = {}, returnType = "DATETIME") public static Expression currentTimestamp() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(varArgs = false, name = "current_timestamp", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "current_timestamp", argTypes = {"INT"}, returnType = "DATETIMEV2") public static Expression currentTimestamp(IntegerLiteral precision) { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone()), precision.getValue()); } @@ -63,12 +63,12 @@ public static Expression currentTimestamp(IntegerLiteral precision) { /** * date acquire function: localtime/localtimestamp */ - @ExecFunction(varArgs = false, name = "localtime", argTypes = {}, returnType = "DATETIME") + @ExecFunction(name = "localtime", argTypes = {}, returnType = "DATETIME") public static Expression localTime() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(varArgs = false, name = "localtimestamp", argTypes = {}, returnType = "DATETIME") + @ExecFunction(name = "localtimestamp", argTypes = {}, returnType = "DATETIME") public static Expression localTimestamp() { return DateTimeV2Literal.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } @@ -76,12 +76,12 @@ public static Expression localTimestamp() { /** * date acquire function: current_date */ - @ExecFunction(varArgs = false, name = "curdate", argTypes = {}, returnType = "DATE") + @ExecFunction(name = "curdate", argTypes = {}, returnType = "DATE") public static Expression curDate() { return DateLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(varArgs = false, name = "current_date", argTypes = {}, returnType = "DATE") + @ExecFunction(name = "current_date", argTypes = {}, returnType = "DATE") public static Expression currentDate() { return DateLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } @@ -90,12 +90,12 @@ public static Expression currentDate() { // /** // * date acquire function: current_time // */ - // @ExecFunction(hasVarArgs = false, name = "curtime", argTypes = {}, returnType = "TIME") + // @ExecFunction(name = "curtime", argTypes = {}, returnType = "TIME") // public static Expression curTime() { // return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); // } - // @ExecFunction(hasVarArgs = false, name = "current_time", argTypes = {}, returnType = "TIME") + // @ExecFunction(name = "current_time", argTypes = {}, returnType = "TIME") // public static Expression currentTime() { // return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); // } @@ -103,7 +103,7 @@ public static Expression currentDate() { /** * date transformation function: unix_timestamp */ - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {}, returnType = "INT") + @ExecFunction(name = "unix_timestamp", argTypes = {}, returnType = "INT") public static Expression unixTimestamp() { return new IntegerLiteral((int) (System.currentTimeMillis() / 1000L)); } @@ -111,7 +111,7 @@ public static Expression unixTimestamp() { /** * date transformation function: utc_timestamp */ - @ExecFunction(varArgs = false, name = "utc_timestamp", argTypes = {}, returnType = "INT") + @ExecFunction(name = "utc_timestamp", argTypes = {}, returnType = "INT") public static Expression utcTimestamp() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(ZoneId.of("UTC+0"))); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java index fa88876a795eee..c10181a1040db4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeArithmetic.java @@ -36,22 +36,22 @@ public class DateTimeArithmetic { /** * datetime arithmetic function date-add. */ - @ExecFunction(varArgs = false, name = "date_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "date_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression dateAdd(DateLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(varArgs = false, name = "date_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "date_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dateAdd(DateTimeLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(varArgs = false, name = "date_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "date_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dateAdd(DateV2Literal date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(varArgs = false, name = "date_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "date_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dateAdd(DateTimeV2Literal date, IntegerLiteral day) { return daysAdd(date, day); } @@ -59,22 +59,22 @@ public static Expression dateAdd(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function date-sub. */ - @ExecFunction(varArgs = false, name = "date_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "date_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression dateSub(DateLiteral date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "date_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "date_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dateSub(DateTimeLiteral date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "date_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "date_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dateSub(DateV2Literal date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "date_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "date_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dateSub(DateTimeV2Literal date, IntegerLiteral day) { return dateAdd(date, new IntegerLiteral(-day.getValue())); } @@ -82,22 +82,22 @@ public static Expression dateSub(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function years-add. */ - @ExecFunction(varArgs = false, name = "years_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "years_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression yearsAdd(DateLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(varArgs = false, name = "years_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "years_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearsAdd(DateTimeLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(varArgs = false, name = "years_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "years_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearsAdd(DateV2Literal date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(varArgs = false, name = "years_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "years_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearsAdd(DateTimeV2Literal date, IntegerLiteral year) { return date.plusYears(year.getValue()); } @@ -105,22 +105,22 @@ public static Expression yearsAdd(DateTimeV2Literal date, IntegerLiteral year) { /** * datetime arithmetic function months-add. */ - @ExecFunction(varArgs = false, name = "months_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "months_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression monthsAdd(DateLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(varArgs = false, name = "months_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "months_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthsAdd(DateTimeLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(varArgs = false, name = "months_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "months_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthsAdd(DateV2Literal date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(varArgs = false, name = "months_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "months_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthsAdd(DateTimeV2Literal date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } @@ -128,22 +128,22 @@ public static Expression monthsAdd(DateTimeV2Literal date, IntegerLiteral month) /** * datetime arithmetic function weeks-add. */ - @ExecFunction(varArgs = false, name = "weeks_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "weeks_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression weeksAdd(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "weeks_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression weeksAdd(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "weeks_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression weeksAdd(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "weeks_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression weeksAdd(DateTimeV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } @@ -151,22 +151,22 @@ public static Expression weeksAdd(DateTimeV2Literal date, IntegerLiteral weeks) /** * datetime arithmetic function days-add. */ - @ExecFunction(varArgs = false, name = "days_add", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "days_add", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression daysAdd(DateLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(varArgs = false, name = "days_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "days_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression daysAdd(DateTimeLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(varArgs = false, name = "days_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "days_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression daysAdd(DateV2Literal date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(varArgs = false, name = "days_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "days_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression daysAdd(DateTimeV2Literal date, IntegerLiteral day) { return date.plusDays(day.getValue()); } @@ -174,12 +174,12 @@ public static Expression daysAdd(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function hours-add. */ - @ExecFunction(varArgs = false, name = "hours_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "hours_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hoursAdd(DateTimeLiteral date, IntegerLiteral hour) { return date.plusHours(hour.getValue()); } - @ExecFunction(varArgs = false, name = "hours_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hours_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hoursAdd(DateTimeV2Literal date, IntegerLiteral hour) { return date.plusHours(hour.getValue()); } @@ -187,12 +187,12 @@ public static Expression hoursAdd(DateTimeV2Literal date, IntegerLiteral hour) { /** * datetime arithmetic function minutes-add. */ - @ExecFunction(varArgs = false, name = "minutes_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "minutes_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minutesAdd(DateTimeLiteral date, IntegerLiteral minute) { return date.plusMinutes(minute.getValue()); } - @ExecFunction(varArgs = false, name = "minutes_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minutes_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minutesAdd(DateTimeV2Literal date, IntegerLiteral minute) { return date.plusMinutes(minute.getValue()); } @@ -200,12 +200,12 @@ public static Expression minutesAdd(DateTimeV2Literal date, IntegerLiteral minut /** * datetime arithmetic function seconds-add. */ - @ExecFunction(varArgs = false, name = "seconds_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "seconds_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondsAdd(DateTimeLiteral date, IntegerLiteral second) { return date.plusSeconds(second.getValue()); } - @ExecFunction(varArgs = false, name = "seconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "seconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondsAdd(DateTimeV2Literal date, IntegerLiteral second) { return date.plusSeconds(second.getValue()); } @@ -213,8 +213,7 @@ public static Expression secondsAdd(DateTimeV2Literal date, IntegerLiteral secon /** * datetime arithmetic function microseconds-add. */ - @ExecFunction(varArgs = false, name = "microseconds_add", - argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "microseconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression microSecondsAdd(DateTimeV2Literal date, IntegerLiteral microSecond) { return date.plusMicroSeconds(microSecond.getValue()); } @@ -222,8 +221,7 @@ public static Expression microSecondsAdd(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function microseconds_sub. */ - @ExecFunction(varArgs = false, name = "microseconds_sub", - argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(name = "microseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression microSecondsSub(DateTimeV2Literal date, IntegerLiteral microSecond) { return date.plusMicroSeconds(-microSecond.getValue()); } @@ -231,8 +229,7 @@ public static Expression microSecondsSub(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function milliseconds_add. */ - @ExecFunction(varArgs = false, name = "milliseconds_add", - argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(name = "milliseconds_add", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression milliSecondsAdd(DateTimeV2Literal date, IntegerLiteral milliSecond) { return date.plusMilliSeconds(milliSecond.getValue()); } @@ -240,8 +237,7 @@ public static Expression milliSecondsAdd(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function milliseconds_sub. */ - @ExecFunction(varArgs = false, name = "milliseconds_sub", - argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") + @ExecFunction(name = "milliseconds_sub", argTypes = { "DATETIMEV2", "INT" }, returnType = "DATETIMEV2") public static Expression milliSecondsSub(DateTimeV2Literal date, IntegerLiteral milliSecond) { return date.plusMilliSeconds(-milliSecond.getValue()); } @@ -249,22 +245,22 @@ public static Expression milliSecondsSub(DateTimeV2Literal date, IntegerLiteral /** * datetime arithmetic function years-sub. */ - @ExecFunction(varArgs = false, name = "years_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "years_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression yearsSub(DateLiteral date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(varArgs = false, name = "years_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "years_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearsSub(DateTimeLiteral date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(varArgs = false, name = "years_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "years_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearsSub(DateV2Literal date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } - @ExecFunction(varArgs = false, name = "years_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "years_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearsSub(DateTimeV2Literal date, IntegerLiteral year) { return yearsAdd(date, new IntegerLiteral(-year.getValue())); } @@ -272,22 +268,22 @@ public static Expression yearsSub(DateTimeV2Literal date, IntegerLiteral year) { /** * datetime arithmetic function months-sub */ - @ExecFunction(varArgs = false, name = "months_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "months_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression monthsSub(DateLiteral date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(varArgs = false, name = "months_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "months_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthsSub(DateTimeLiteral date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(varArgs = false, name = "months_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "months_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthsSub(DateV2Literal date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } - @ExecFunction(varArgs = false, name = "months_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "months_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthsSub(DateTimeV2Literal date, IntegerLiteral month) { return monthsAdd(date, new IntegerLiteral(-month.getValue())); } @@ -295,22 +291,22 @@ public static Expression monthsSub(DateTimeV2Literal date, IntegerLiteral month) /** * datetime arithmetic function weeks-sub. */ - @ExecFunction(varArgs = false, name = "weeks_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "weeks_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression weeksSub(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "weeks_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression weeksSub(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "weeks_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression weeksSub(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(varArgs = false, name = "weeks_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "weeks_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression weeksSub(DateTimeV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } @@ -318,22 +314,22 @@ public static Expression weeksSub(DateTimeV2Literal date, IntegerLiteral weeks) /** * datetime arithmetic function days-sub */ - @ExecFunction(varArgs = false, name = "days_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") + @ExecFunction(name = "days_sub", argTypes = {"DATE", "INT"}, returnType = "DATE") public static Expression daysSub(DateLiteral date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "days_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "days_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression daysSub(DateTimeLiteral date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "days_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "days_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression daysSub(DateV2Literal date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } - @ExecFunction(varArgs = false, name = "days_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "days_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression daysSub(DateTimeV2Literal date, IntegerLiteral day) { return daysAdd(date, new IntegerLiteral(-day.getValue())); } @@ -341,12 +337,12 @@ public static Expression daysSub(DateTimeV2Literal date, IntegerLiteral day) { /** * datetime arithmetic function hours-sub */ - @ExecFunction(varArgs = false, name = "hours_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "hours_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hoursSub(DateTimeLiteral date, IntegerLiteral hour) { return hoursAdd(date, new IntegerLiteral(-hour.getValue())); } - @ExecFunction(varArgs = false, name = "hours_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hours_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hoursSub(DateTimeV2Literal date, IntegerLiteral hour) { return hoursAdd(date, new IntegerLiteral(-hour.getValue())); } @@ -354,12 +350,12 @@ public static Expression hoursSub(DateTimeV2Literal date, IntegerLiteral hour) { /** * datetime arithmetic function minutes-sub */ - @ExecFunction(varArgs = false, name = "minutes_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "minutes_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minutesSub(DateTimeLiteral date, IntegerLiteral minute) { return minutesAdd(date, new IntegerLiteral(-minute.getValue())); } - @ExecFunction(varArgs = false, name = "minutes_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minutes_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minutesSub(DateTimeV2Literal date, IntegerLiteral minute) { return minutesAdd(date, new IntegerLiteral(-minute.getValue())); } @@ -367,12 +363,12 @@ public static Expression minutesSub(DateTimeV2Literal date, IntegerLiteral minut /** * datetime arithmetic function seconds-sub */ - @ExecFunction(varArgs = false, name = "seconds_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "seconds_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondsSub(DateTimeLiteral date, IntegerLiteral second) { return secondsAdd(date, new IntegerLiteral(-second.getValue())); } - @ExecFunction(varArgs = false, name = "seconds_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "seconds_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondsSub(DateTimeV2Literal date, IntegerLiteral second) { return secondsAdd(date, new IntegerLiteral(-second.getValue())); } @@ -380,27 +376,27 @@ public static Expression secondsSub(DateTimeV2Literal date, IntegerLiteral secon /** * datetime arithmetic function datediff */ - @ExecFunction(varArgs = false, name = "datediff", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") + @ExecFunction(name = "datediff", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") public static Expression dateDiff(DateTimeLiteral date1, DateTimeLiteral date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "datediff", argTypes = {"DATEV2", "DATEV2"}, returnType = "INT") + @ExecFunction(name = "datediff", argTypes = {"DATEV2", "DATEV2"}, returnType = "INT") public static Expression dateDiff(DateV2Literal date1, DateV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "datediff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "datediff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "INT") public static Expression dateDiff(DateV2Literal date1, DateTimeV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "datediff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "INT") + @ExecFunction(name = "datediff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "INT") public static Expression dateDiff(DateTimeV2Literal date1, DateV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "datediff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "datediff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") public static Expression dateDiff(DateTimeV2Literal date1, DateTimeV2Literal date2) { return new IntegerLiteral(dateDiff(date1.toJavaDateType(), date2.toJavaDateType())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java index 0c7d5638b05fec..9742602a07a249 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java @@ -67,7 +67,7 @@ public class DateTimeExtractAndTransform { /** * datetime arithmetic function date-v2 */ - @ExecFunction(varArgs = false, name = "datev2", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "datev2", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression dateV2(DateTimeV2Literal dateTime) { return new DateV2Literal(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } @@ -75,22 +75,22 @@ public static Expression dateV2(DateTimeV2Literal dateTime) { /** * Executable datetime extract year */ - @ExecFunction(varArgs = false, name = "year", argTypes = {"DATE"}, returnType = "SMALLINT") + @ExecFunction(name = "year", argTypes = {"DATE"}, returnType = "SMALLINT") public static Expression year(DateLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(varArgs = false, name = "year", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(name = "year", argTypes = {"DATETIME"}, returnType = "SMALLINT") public static Expression year(DateTimeLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(varArgs = false, name = "year", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "year", argTypes = {"DATEV2"}, returnType = "SMALLINT") public static Expression year(DateV2Literal date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(varArgs = false, name = "year", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "year", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") public static Expression year(DateTimeV2Literal date) { return new SmallIntLiteral(((short) date.getYear())); } @@ -98,22 +98,22 @@ public static Expression year(DateTimeV2Literal date) { /** * Executable datetime extract quarter */ - @ExecFunction(varArgs = false, name = "quarter", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "quarter", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression quarter(DateLiteral date) { return new TinyIntLiteral((byte) (((byte) date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(varArgs = false, name = "quarter", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "quarter", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression quarter(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(varArgs = false, name = "quarter", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "quarter", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression quarter(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(varArgs = false, name = "quarter", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "quarter", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression quarter(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } @@ -121,22 +121,22 @@ public static Expression quarter(DateTimeV2Literal date) { /** * Executable datetime extract month */ - @ExecFunction(varArgs = false, name = "month", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "month", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression month(DateLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(varArgs = false, name = "month", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "month", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression month(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(varArgs = false, name = "month", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "month", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression month(DateV2Literal date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(varArgs = false, name = "month", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "month", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression month(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.getMonth()); } @@ -144,22 +144,22 @@ public static Expression month(DateTimeV2Literal date) { /** * Executable datetime extract day */ - @ExecFunction(varArgs = false, name = "day", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "day", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression day(DateLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(varArgs = false, name = "day", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "day", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression day(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(varArgs = false, name = "day", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "day", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression day(DateV2Literal date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(varArgs = false, name = "day", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "day", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression day(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.getDay()); } @@ -167,12 +167,12 @@ public static Expression day(DateTimeV2Literal date) { /** * Executable datetime extract hour */ - @ExecFunction(varArgs = false, name = "hour", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "hour", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression hour(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getHour())); } - @ExecFunction(varArgs = false, name = "hour", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "hour", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression hour(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getHour())); } @@ -180,12 +180,12 @@ public static Expression hour(DateTimeV2Literal date) { /** * Executable datetime extract hour */ - @ExecFunction(varArgs = false, name = "minute", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "minute", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression minute(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getMinute())); } - @ExecFunction(varArgs = false, name = "minute", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "minute", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression minute(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getMinute())); } @@ -193,12 +193,12 @@ public static Expression minute(DateTimeV2Literal date) { /** * Executable datetime extract second */ - @ExecFunction(varArgs = false, name = "second", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "second", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression second(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getSecond())); } - @ExecFunction(varArgs = false, name = "second", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "second", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression second(DateTimeV2Literal date) { return new TinyIntLiteral(((byte) date.getSecond())); } @@ -206,7 +206,7 @@ public static Expression second(DateTimeV2Literal date) { /** * Executable datetime extract microsecond */ - @ExecFunction(varArgs = false, name = "microsecond", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "microsecond", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression microsecond(DateTimeV2Literal date) { return new IntegerLiteral(((int) date.getMicroSecond())); } @@ -214,22 +214,22 @@ public static Expression microsecond(DateTimeV2Literal date) { /** * Executable datetime extract dayofyear */ - @ExecFunction(varArgs = false, name = "dayofyear", argTypes = {"DATE"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear", argTypes = {"DATE"}, returnType = "SMALLINT") public static Expression dayOfYear(DateLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(varArgs = false, name = "dayofyear", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear", argTypes = {"DATETIME"}, returnType = "SMALLINT") public static Expression dayOfYear(DateTimeLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(varArgs = false, name = "dayofyear", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear", argTypes = {"DATEV2"}, returnType = "SMALLINT") public static Expression dayOfYear(DateV2Literal date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(varArgs = false, name = "dayofyear", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") public static Expression dayOfYear(DateTimeV2Literal date) { return new SmallIntLiteral((short) date.getDayOfYear()); } @@ -237,22 +237,22 @@ public static Expression dayOfYear(DateTimeV2Literal date) { /** * Executable datetime extract dayofmonth */ - @ExecFunction(varArgs = false, name = "dayofmonth", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression dayOfMonth(DateLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(varArgs = false, name = "dayofmonth", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression dayOfMonth(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(varArgs = false, name = "dayofmonth", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression dayOfMonth(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(varArgs = false, name = "dayofmonth", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression dayOfMonth(DateTimeV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } @@ -260,22 +260,22 @@ public static Expression dayOfMonth(DateTimeV2Literal date) { /** * Executable datetime extract dayofweek */ - @ExecFunction(varArgs = false, name = "dayofweek", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression dayOfWeek(DateLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(varArgs = false, name = "dayofweek", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression dayOfWeek(DateTimeLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(varArgs = false, name = "dayofweek", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression dayOfWeek(DateV2Literal date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(varArgs = false, name = "dayofweek", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression dayOfWeek(DateTimeV2Literal date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } @@ -291,26 +291,26 @@ private static LocalDateTime firstDayOfWeek(LocalDateTime dateTime) { /** * datetime arithmetic function date-format */ - @ExecFunction(varArgs = false, name = "date_format", argTypes = {"DATE", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "date_format", argTypes = {"DATE", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateLiteral date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDate.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay())))); } - @ExecFunction(varArgs = false, name = "date_format", argTypes = {"DATETIME", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "date_format", argTypes = {"DATETIME", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateTimeLiteral date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDateTime.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay()), ((int) date.getHour()), ((int) date.getMinute()), ((int) date.getSecond())))); } - @ExecFunction(varArgs = false, name = "date_format", argTypes = {"DATEV2", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "date_format", argTypes = {"DATEV2", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateV2Literal date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDate.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay())))); } - @ExecFunction(varArgs = false, name = "date_format", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "date_format", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "VARCHAR") public static Expression dateFormat(DateTimeV2Literal date, StringLikeLiteral format) { return new VarcharLiteral(DateUtils.formatBuilder(format.getValue()).toFormatter().format( java.time.LocalDateTime.of(((int) date.getYear()), ((int) date.getMonth()), ((int) date.getDay()), @@ -320,12 +320,12 @@ public static Expression dateFormat(DateTimeV2Literal date, StringLikeLiteral fo /** * datetime arithmetic function date */ - @ExecFunction(varArgs = false, name = "date", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(name = "date", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression date(DateTimeLiteral dateTime) throws AnalysisException { return new DateLiteral(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } - @ExecFunction(varArgs = false, name = "date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression date(DateTimeV2Literal dateTime) throws AnalysisException { return new DateV2Literal(dateTime.getYear(), dateTime.getMonth(), dateTime.getDay()); } @@ -333,22 +333,22 @@ public static Expression date(DateTimeV2Literal dateTime) throws AnalysisExcepti /** * datetime arithmetic function date-trunc */ - @ExecFunction(varArgs = false, name = "date_trunc", argTypes = {"DATETIME", "VARCHAR"}, returnType = "DATETIME") + @ExecFunction(name = "date_trunc", argTypes = {"DATETIME", "VARCHAR"}, returnType = "DATETIME") public static Expression dateTrunc(DateTimeLiteral date, StringLikeLiteral trunc) { return DateTimeLiteral.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(varArgs = false, name = "date_trunc", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(name = "date_trunc", argTypes = {"DATETIMEV2", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression dateTrunc(DateTimeV2Literal date, StringLikeLiteral trunc) { return DateTimeV2Literal.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(varArgs = false, name = "date_trunc", argTypes = {"DATE", "VARCHAR"}, returnType = "DATE") + @ExecFunction(name = "date_trunc", argTypes = {"DATE", "VARCHAR"}, returnType = "DATE") public static Expression dateTrunc(DateLiteral date, StringLikeLiteral trunc) { return DateLiteral.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } - @ExecFunction(varArgs = false, name = "date_trunc", argTypes = {"DATEV2", "VARCHAR"}, returnType = "DATEV2") + @ExecFunction(name = "date_trunc", argTypes = {"DATEV2", "VARCHAR"}, returnType = "DATEV2") public static Expression dateTrunc(DateV2Literal date, StringLikeLiteral trunc) { return DateV2Literal.fromJavaDateType(dateTruncHelper(date.toJavaDateType(), trunc.getValue())); } @@ -395,7 +395,7 @@ private static LocalDateTime dateTruncHelper(LocalDateTime dateTime, String trun /** * from_days. */ - @ExecFunction(varArgs = false, name = "from_days", argTypes = {"INT"}, returnType = "DATEV2") + @ExecFunction(name = "from_days", argTypes = {"INT"}, returnType = "DATEV2") public static Expression fromDays(IntegerLiteral n) { // doris treat 0000AD as ordinary year but java LocalDateTime treat it as lunar year. LocalDateTime res = LocalDateTime.of(0, 1, 1, 0, 0, 0) @@ -406,28 +406,28 @@ public static Expression fromDays(IntegerLiteral n) { return DateV2Literal.fromJavaDateType(res); } - @ExecFunction(varArgs = false, name = "last_day", argTypes = {"DATE"}, returnType = "DATE") + @ExecFunction(name = "last_day", argTypes = {"DATE"}, returnType = "DATE") public static Expression lastDay(DateLiteral date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateLiteral.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(varArgs = false, name = "last_day", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(name = "last_day", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression lastDay(DateTimeLiteral date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateLiteral.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(varArgs = false, name = "last_day", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "last_day", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression lastDay(DateV2Literal date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); return DateV2Literal.fromJavaDateType(nextMonthFirstDay.minusDays(1)); } - @ExecFunction(varArgs = false, name = "last_day", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "last_day", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression lastDay(DateTimeV2Literal date) { LocalDateTime nextMonthFirstDay = LocalDateTime.of((int) date.getYear(), (int) date.getMonth(), 1, 0, 0, 0).plusMonths(1); @@ -437,22 +437,22 @@ public static Expression lastDay(DateTimeV2Literal date) { /** * datetime transformation function: to_monday */ - @ExecFunction(varArgs = false, name = "to_monday", argTypes = {"DATE"}, returnType = "DATE") + @ExecFunction(name = "to_monday", argTypes = {"DATE"}, returnType = "DATE") public static Expression toMonday(DateLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "to_monday", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(name = "to_monday", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression toMonday(DateTimeLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "to_monday", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "to_monday", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression toMonday(DateV2Literal date) { return DateV2Literal.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "to_monday", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "to_monday", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression toMonday(DateTimeV2Literal date) { return DateV2Literal.fromJavaDateType(toMonday(date.toJavaDateType())); } @@ -469,7 +469,7 @@ private static LocalDateTime toMonday(LocalDateTime dateTime) { /** * date transformation function: from_unixtime */ - @ExecFunction(varArgs = false, name = "from_unixtime", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(name = "from_unixtime", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression fromUnixTime(BigIntLiteral second) { return fromUnixTime(second, new VarcharLiteral("%Y-%m-%d %H:%i:%s")); } @@ -477,7 +477,7 @@ public static Expression fromUnixTime(BigIntLiteral second) { /** * date transformation function: from_unixtime */ - @ExecFunction(varArgs = false, name = "from_unixtime", argTypes = {"BIGINT", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "from_unixtime", argTypes = {"BIGINT", "VARCHAR"}, returnType = "VARCHAR") public static Expression fromUnixTime(BigIntLiteral second, StringLikeLiteral format) { // 32536771199L is max valid timestamp of mysql from_unix_time if (second.getValue() < 0 || second.getValue() > 32536771199L) { @@ -497,17 +497,17 @@ public static Expression fromUnixTime(BigIntLiteral second, StringLikeLiteral fo /** * date transformation function: unix_timestamp */ - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(name = "unix_timestamp", argTypes = {"DATE"}, returnType = "INT") public static Expression unixTimestamp(DateLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") public static Expression unixTimestamp(DateTimeLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") public static Expression unixTimestamp(DateV2Literal date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } @@ -515,7 +515,7 @@ public static Expression unixTimestamp(DateV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") + @ExecFunction(name = "unix_timestamp", argTypes = {"DATETIMEV2"}, returnType = "DECIMALV3") public static Expression unixTimestamp(DateTimeV2Literal date) { if (date.getMicroSecond() == 0) { return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck(10, 0), @@ -529,7 +529,7 @@ public static Expression unixTimestamp(DateTimeV2Literal date) { /** * date transformation function: unix_timestamp */ - @ExecFunction(varArgs = false, name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") + @ExecFunction(name = "unix_timestamp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DECIMALV3") public static Expression unixTimestamp(StringLikeLiteral date, StringLikeLiteral format) { DateTimeFormatter formatter = DateUtils.formatBuilder(format.getValue()).toFormatter(); LocalDateTime dateObj; @@ -564,12 +564,12 @@ private static String getTimestamp(LocalDateTime dateTime) { /** * date transformation function: to_date */ - @ExecFunction(varArgs = false, name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(name = "to_date", argTypes = {"DATETIME"}, returnType = "DATE") public static Expression toDate(DateTimeLiteral date) { return new DateLiteral(date.getYear(), date.getMonth(), date.getDay()); } - @ExecFunction(varArgs = false, name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "to_date", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") public static Expression toDate(DateTimeV2Literal date) { return new DateV2Literal(date.getYear(), date.getMonth(), date.getDay()); } @@ -577,25 +577,25 @@ public static Expression toDate(DateTimeV2Literal date) { /** * date transformation function: to_days */ - @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATE"}, returnType = "INT") + @ExecFunction(name = "to_days", argTypes = {"DATE"}, returnType = "INT") public static Expression toDays(DateLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(name = "to_days", argTypes = {"DATETIME"}, returnType = "INT") public static Expression toDays(DateTimeLiteral date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(name = "to_days", argTypes = {"DATEV2"}, returnType = "INT") public static Expression toDays(DateV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); } - @ExecFunction(varArgs = false, name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "to_days", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression toDays(DateTimeV2Literal date) { return new IntegerLiteral(((int) Duration.between( LocalDateTime.of(0, 1, 1, 0, 0, 0), date.toJavaDateType()).toDays())); @@ -604,7 +604,7 @@ public static Expression toDays(DateTimeV2Literal date) { /** * date transformation function: makedate */ - @ExecFunction(varArgs = false, name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") + @ExecFunction(name = "makedate", argTypes = {"INT", "INT"}, returnType = "DATE") public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) { int day = dayOfYear.getValue(); return day > 0 ? DateLiteral.fromJavaDateType(LocalDateTime.of(year.getValue(), 1, 1, 0, 0, 0) @@ -614,7 +614,7 @@ public static Expression makeDate(IntegerLiteral year, IntegerLiteral dayOfYear) /** * date transformation function: str_to_date */ - @ExecFunction(varArgs = false, name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(name = "str_to_date", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral format) { if (org.apache.doris.analysis.DateLiteral.hasTimePart(format.getStringValue())) { DataType returnType = DataType.fromCatalogType(ScalarType.getDefaultDateType(Type.DATETIME)); @@ -637,12 +637,12 @@ public static Expression strToDate(StringLikeLiteral str, StringLikeLiteral form } } - @ExecFunction(varArgs = false, name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "timestamp", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression timestamp(DateTimeLiteral datetime) { return datetime; } - @ExecFunction(varArgs = false, name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression timestamp(DateTimeV2Literal datetime) { return datetime; } @@ -650,8 +650,7 @@ public static Expression timestamp(DateTimeV2Literal datetime) { /** * convert_tz */ - @ExecFunction(varArgs = false, name = "convert_tz", - argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") + @ExecFunction(name = "convert_tz", argTypes = {"DATETIMEV2", "VARCHAR", "VARCHAR"}, returnType = "DATETIMEV2") public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral fromTz, StringLikeLiteral toTz) { DateTimeFormatter zoneFormatter = new DateTimeFormatterBuilder() .parseCaseInsensitive() @@ -666,52 +665,52 @@ public static Expression convertTz(DateTimeV2Literal datetime, StringLikeLiteral return DateTimeV2Literal.fromJavaDateType(resultDateTime.toLocalDateTime(), datetime.getDataType().getScale()); } - @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") + @ExecFunction(name = "weekday", argTypes = {"DATE"}, returnType = "TINYINT") public static Expression weekDay(DateLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekDay(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekDay(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(varArgs = false, name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekDay(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeV2Literal dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") public static Expression week(DateTimeLiteral dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression week(DateV2Literal date) { return week(date.toJavaDateType(), 0); } - @ExecFunction(varArgs = false, name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") public static Expression week(DateV2Literal date, IntegerLiteral mode) { return week(date.toJavaDateType(), mode.getIntValue()); } @@ -776,32 +775,32 @@ private static boolean isSpecificDate(LocalDateTime localDateTime) { && (localDateTime.getDayOfMonth() == 1 || localDateTime.getDayOfMonth() == 2); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date, IntegerLiteral mode) { return yearWeek(date.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") public static Expression yearWeek(DateV2Literal date) { return yearWeek(date.toJavaDateType(), 0); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") public static Expression yearWeek(DateTimeV2Literal dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } - @ExecFunction(varArgs = false, name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") public static Expression yearWeek(DateTimeLiteral dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } @@ -869,7 +868,7 @@ public static Expression yearWeek(LocalDateTime localDateTime, int mode) { /** * weekofyear */ - @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekofyear", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeV2Literal dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -884,7 +883,7 @@ public static Expression weekOfYear(DateTimeV2Literal dateTime) { /** * weekofyear */ - @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "weekofyear", argTypes = {"DATETIME"}, returnType = "TINYINT") public static Expression weekOfYear(DateTimeLiteral dateTime) { if (dateTime.getYear() == 0 && dateTime.getDayOfWeek() == 1) { if (dateTime.getMonth() == 1 && dateTime.getDay() == 2) { @@ -899,7 +898,7 @@ public static Expression weekOfYear(DateTimeLiteral dateTime) { /** * weekofyear */ - @ExecFunction(varArgs = false, name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekofyear", argTypes = {"DATEV2"}, returnType = "TINYINT") public static Expression weekOfYear(DateV2Literal date) { if (date.getYear() == 0 && date.getDayOfWeek() == 1) { if (date.getMonth() == 1 && date.getDay() == 2) { @@ -910,53 +909,53 @@ public static Expression weekOfYear(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().get(WeekFields.ISO.weekOfWeekBasedYear())); } - @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(name = "dayname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression dayName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(name = "dayname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression dayName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(name = "dayname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression dayName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") + @ExecFunction(name = "monthname", argTypes = {"DATETIMEV2"}, returnType = "VARCHAR") public static Expression monthName(DateTimeV2Literal dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") + @ExecFunction(name = "monthname", argTypes = {"DATETIME"}, returnType = "VARCHAR") public static Expression monthName(DateTimeLiteral dateTime) { return new VarcharLiteral(dateTime.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") + @ExecFunction(name = "monthname", argTypes = {"DATEV2"}, returnType = "VARCHAR") public static Expression monthName(DateV2Literal date) { return new VarcharLiteral(date.toJavaDateType().getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault())); } - @ExecFunction(varArgs = false, name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "from_second", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromSecond(BigIntLiteral second) { return fromMicroSecond(second.getValue() * 1000 * 1000); } - @ExecFunction(varArgs = false, name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMilliSecond(BigIntLiteral milliSecond) { return fromMicroSecond(milliSecond.getValue() * 1000); } - @ExecFunction(varArgs = false, name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") public static Expression fromMicroSecond(BigIntLiteral microSecond) { return fromMicroSecond(microSecond.getValue()); } @@ -973,191 +972,187 @@ private static Expression fromMicroSecond(long microSecond) { dateTime.getMinute(), dateTime.getSecond(), dateTime.getNano() / 1000); } - @ExecFunction(varArgs = false, name = "microseconds_diff", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "microseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression microsecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MICROS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "milliseconds_diff", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "milliseconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression millisecondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MILLIS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "seconds_diff", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "seconds_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "seconds_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "seconds_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "seconds_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression secondsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "seconds_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression secondsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.SECONDS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "minutes_diff", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "minutes_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "minutes_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "minutes_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "minutes_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression minutesDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "minutes_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression minutesDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MINUTES.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "hours_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "hours_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "hours_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "hours_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression hoursDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "hours_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression hoursDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.HOURS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "days_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "days_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "days_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "days_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression daysDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "days_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression daysDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.DAYS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "weeks_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "weeks_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "weeks_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "weeks_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression weeksDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "weeks_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression weeksDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.WEEKS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "months_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "months_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "months_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "months_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression monthsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "months_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression monthsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.MONTHS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "years_diff", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "years_diff", argTypes = {"DATETIMEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") + @ExecFunction(name = "years_diff", argTypes = {"DATEV2", "DATETIMEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateTimeV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") + @ExecFunction(name = "years_diff", argTypes = {"DATEV2", "DATEV2"}, returnType = "BIGINT") public static Expression yearsDiff(DateV2Literal t1, DateV2Literal t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } - @ExecFunction(varArgs = false, name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") + @ExecFunction(name = "years_diff", argTypes = {"DATETIME", "DATETIME"}, returnType = "BIGINT") public static Expression yearsDiff(DateTimeLiteral t1, DateTimeLiteral t2) { return new BigIntLiteral(ChronoUnit.YEARS.between(t2.toJavaDateType(), t1.toJavaDateType())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java index 27c3bfe1a4fff8..42ad228ad722d7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java @@ -47,47 +47,47 @@ public class ExecutableFunctions { /** * other scalar function */ - @ExecFunction(varArgs = false, name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") + @ExecFunction(name = "abs", argTypes = {"TINYINT"}, returnType = "SMALLINT") public static Expression abs(TinyIntLiteral literal) { return new SmallIntLiteral((short) Math.abs(literal.getValue())); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") + @ExecFunction(name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") public static Expression abs(SmallIntLiteral literal) { return new IntegerLiteral(Math.abs(literal.getValue())); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"INT"}, returnType = "BIGINT") + @ExecFunction(name = "abs", argTypes = {"INT"}, returnType = "BIGINT") public static Expression abs(IntegerLiteral literal) { return new BigIntLiteral(Math.abs((long) literal.getValue())); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") + @ExecFunction(name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") public static Expression abs(BigIntLiteral literal) { return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") public static Expression abs(LargeIntLiteral literal) { return new LargeIntLiteral(literal.getValue().abs()); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") + @ExecFunction(name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") public static Expression abs(FloatLiteral literal) { return new FloatLiteral(Math.abs(literal.getValue())); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression abs(DoubleLiteral literal) { return new DoubleLiteral(Math.abs(literal.getValue())); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") public static Expression abs(DecimalLiteral literal) { return new DecimalLiteral(literal.getValue().abs()); } - @ExecFunction(varArgs = false, name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") public static Expression abs(DecimalV3Literal literal) { return new DecimalV3Literal(literal.getValue().abs()); } @@ -95,7 +95,7 @@ public static Expression abs(DecimalV3Literal literal) { /** * acos scalar function */ - @ExecFunction(varArgs = false, name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "acos", argTypes = {"DOUBLE"}, returnType = "DOUBLE") public static Expression acos(DoubleLiteral literal) { double result = Math.acos(literal.getValue()); if (Double.isNaN(result)) { @@ -105,8 +105,7 @@ public static Expression acos(DoubleLiteral literal) { } } - @ExecFunction(varArgs = false, name = "append_trailing_char_if_absent", - argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, StringLikeLiteral chr) { if (literal.getValue().length() != 1) { return null; @@ -115,12 +114,12 @@ public static Expression appendTrailingIfCharAbsent(StringLikeLiteral literal, S : new VarcharLiteral(literal.getValue() + chr.getValue()); } - @ExecFunction(varArgs = false, name = "e", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(name = "e", argTypes = {}, returnType = "DOUBLE") public static Expression e() { // CHECKSTYLE IGNORE THIS LINE return new DoubleLiteral(Math.E); } - @ExecFunction(varArgs = false, name = "p1", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(name = "p1", argTypes = {}, returnType = "DOUBLE") public static Expression pi() { return new DoubleLiteral(Math.PI); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java index 8f1937c83a1fbb..9477de8ed1a890 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java @@ -41,169 +41,169 @@ public class NumericArithmetic { /** * Executable arithmetic functions add */ - @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(name = "add", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression addTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.addExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "add", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression addTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression addTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression addTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(name = "add", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression addSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "add", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression addSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.addExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression addSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression addSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression addIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression addIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression addIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.addExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression addIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression addBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression addBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression addBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "add", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression addBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.addExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().add(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"LARGEINT", "TINYINT"}, returnType = "LARGEINT") public static Expression addLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "LARGEINT") public static Expression addLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"LARGEINT", "INT"}, returnType = "LARGEINT") public static Expression addLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"LARGEINT", "BIGINT"}, returnType = "LARGEINT") public static Expression addLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "add", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression addLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().add(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "add", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression addDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() + second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "add", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression addDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(varArgs = false, name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "add", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().add(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -212,169 +212,169 @@ public static Expression addDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3 /** * Executable arithmetic functions subtract */ - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(name = "subtract", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression subtractTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.subtractExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "subtract", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression subtractTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression subtractTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "subtract", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression subtractSmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression subtractSmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.subtractExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression subtractSmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractSmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "subtract", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractSmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression subtractIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.subtractExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "subtract", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression subtractBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.subtractExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "subtract", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().subtract(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression subtractLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression subtractLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression subtractLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression subtractLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "subtract", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression subtractLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().subtract(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "subtract", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression subtractDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() - second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "subtract", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression subtractDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalLiteral(result); } - @ExecFunction(varArgs = false, name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "subtract", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().subtract(second.getValue()); return new DecimalV3Literal((DecimalV3Type) first.getDataType(), result); @@ -383,163 +383,163 @@ public static Expression subtractDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions multiply */ - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") + @ExecFunction(name = "multiply", argTypes = {"TINYINT", "TINYINT"}, returnType = "SMALLINT") public static Expression multiplyTinyIntTinyInt(TinyIntLiteral first, TinyIntLiteral second) { short result = (short) Math.multiplyExact(first.getValue(), second.getValue()); return new SmallIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "multiply", argTypes = {"TINYINT", "SMALLINT"}, returnType = "INT") public static Expression multiplyTinyIntSmallInt(TinyIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"TINYINT", "INT"}, returnType = "BIGINT") public static Expression multiplyTinyIntInt(TinyIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"TINYINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyTinyIntBigInt(TinyIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "multiply", argTypes = {"TINYINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyTinyIntLargeInt(TinyIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") + @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "TINYINT"}, returnType = "INT") public static Expression multiplySmallIntTinyInt(SmallIntLiteral first, TinyIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") public static Expression multiplySmallIntSmallInt(SmallIntLiteral first, SmallIntLiteral second) { int result = Math.multiplyExact(first.getValue(), second.getValue()); return new IntegerLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "INT"}, returnType = "BIGINT") public static Expression multiplySmallIntInt(SmallIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplySmallIntBigInt(SmallIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "multiply", argTypes = {"SMALLINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplySmallIntLargeInt(SmallIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"INT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyIntTinyInt(IntegerLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"INT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyIntSmallInt(IntegerLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"INT", "INT"}, returnType = "BIGINT") public static Expression multiplyIntInt(IntegerLiteral first, IntegerLiteral second) { long result = Math.multiplyExact((long) first.getValue(), (long) second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"INT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyIntBigInt(IntegerLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "multiply", argTypes = {"INT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyIntLargeInt(IntegerLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"BIGINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyBigIntTinyInt(BigIntLiteral first, TinyIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"BIGINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyBigIntSmallInt(BigIntLiteral first, SmallIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"BIGINT", "INT"}, returnType = "BIGINT") public static Expression multiplyBigIntInt(BigIntLiteral first, IntegerLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"BIGINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyBigIntBigInt(BigIntLiteral first, BigIntLiteral second) { long result = Math.multiplyExact(first.getValue(), second.getValue()); return new BigIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "multiply", argTypes = {"BIGINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyBigIntLargeInt(BigIntLiteral first, LargeIntLiteral second) { BigInteger result = second.getValue().multiply(new BigInteger(first.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "TINYINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntTinyInt(LargeIntLiteral first, TinyIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "SMALLINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntSmallInt(LargeIntLiteral first, SmallIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "INT"}, returnType = "BIGINT") public static Expression multiplyLargeIntInt(LargeIntLiteral first, IntegerLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") + @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "BIGINT"}, returnType = "BIGINT") public static Expression multiplyLargeIntBigInt(LargeIntLiteral first, BigIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "multiply", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "LARGEINT") public static Expression multiplyLargeIntLargeInt(LargeIntLiteral first, LargeIntLiteral second) { BigInteger result = first.getValue().multiply(new BigInteger(second.getValue().toString())); return new LargeIntLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "multiply", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression multiplyDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() * second.getValue(); return new DoubleLiteral(result); } - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "multiply", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLiteral second) { BigDecimal result = first.getValue().multiply(second.getValue()); return new DecimalLiteral(result); @@ -548,7 +548,7 @@ public static Expression multiplyDecimalDecimal(DecimalLiteral first, DecimalLit /** * decimalV3 multiply in FE */ - @ExecFunction(varArgs = false, name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "multiply", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, DecimalV3Literal second) { BigDecimal result = first.getValue().multiply(second.getValue()); DecimalV3Type t1 = (DecimalV3Type) first.getDataType(); @@ -561,7 +561,7 @@ public static Expression multiplyDecimalV3DecimalV3(DecimalV3Literal first, Deci /** * Executable arithmetic functions divide */ - @ExecFunction(varArgs = false, name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "divide", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "DOUBLE") public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) { if (second.getValue() == 0.0) { return new NullLiteral(first.getDataType()); @@ -573,7 +573,7 @@ public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) /** * Executable arithmetic functions divide */ - @ExecFunction(varArgs = false, name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "divide", argTypes = {"DECIMALV2", "DECIMALV2"}, returnType = "DECIMALV2") public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral second) { if (first.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); @@ -585,7 +585,7 @@ public static Expression divideDecimal(DecimalLiteral first, DecimalLiteral seco /** * decimalv3 divide in FE */ - @ExecFunction(varArgs = false, name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "divide", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "DECIMALV3") public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Literal second) { if (second.getValue().compareTo(BigDecimal.ZERO) == 0) { return new NullLiteral(first.getDataType()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 1e239839073707..4fb057b8cc7f1f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -56,7 +56,7 @@ public class StringArithmetic { /** * Executable arithmetic functions concat */ - @ExecFunction(varArgs = false, name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiteral second) { String result = first.getValue() + second.getValue(); return new VarcharLiteral(result); @@ -65,7 +65,7 @@ public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiter /** * Executable arithmetic functions substring */ - @ExecFunction(varArgs = false, name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { int stringLength = first.getValue().length(); if (stringLength == 0) { @@ -95,7 +95,7 @@ public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLit /** * Executable arithmetic functions length */ - @ExecFunction(varArgs = false, name = "length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "length", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression lengthVarchar(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -103,7 +103,7 @@ public static Expression lengthVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Lower */ - @ExecFunction(varArgs = false, name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression lowerVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toLowerCase()); } @@ -111,7 +111,7 @@ public static Expression lowerVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Upper */ - @ExecFunction(varArgs = false, name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression upperVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().toUpperCase()); } @@ -119,7 +119,7 @@ public static Expression upperVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Trim */ - @ExecFunction(varArgs = false, name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression trimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().strip()); } @@ -127,7 +127,7 @@ public static Expression trimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions LTrim */ - @ExecFunction(varArgs = false, name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression ltrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripLeading()); } @@ -135,7 +135,7 @@ public static Expression ltrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions RTrim */ - @ExecFunction(varArgs = false, name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression rtrimVarchar(VarcharLiteral first) { return new VarcharLiteral(first.getValue().stripTrailing()); } @@ -143,8 +143,7 @@ public static Expression rtrimVarchar(VarcharLiteral first) { /** * Executable arithmetic functions Replace */ - @ExecFunction(varArgs = false, name = "replace", - argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression replace(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { if (second.getValue().length() == 0) { return new VarcharLiteral(first.getValue()); @@ -155,7 +154,7 @@ public static Expression replace(VarcharLiteral first, VarcharLiteral second, Va /** * Executable arithmetic functions Left */ - @ExecFunction(varArgs = false, name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression left(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -169,7 +168,7 @@ public static Expression left(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Right */ - @ExecFunction(varArgs = false, name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression right(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return new VarcharLiteral(""); @@ -189,7 +188,7 @@ public static Expression right(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Locate */ - @ExecFunction(varArgs = false, name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression locate(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(second.getValue().strip().indexOf(first.getValue()) + 1); } @@ -197,7 +196,7 @@ public static Expression locate(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Instr */ - @ExecFunction(varArgs = false, name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression instr(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); } @@ -205,7 +204,7 @@ public static Expression instr(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions Ascii */ - @ExecFunction(varArgs = false, name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression ascii(VarcharLiteral first) { if (first.getValue().length() == 0) { return new IntegerLiteral(0); @@ -217,7 +216,7 @@ public static Expression ascii(VarcharLiteral first) { /** * Executable arithmetic functions Bin */ - @ExecFunction(varArgs = false, name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") public static Expression bin(BigIntLiteral first) { return new VarcharLiteral(Long.toBinaryString(first.getValue())); } @@ -225,7 +224,7 @@ public static Expression bin(BigIntLiteral first) { /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(varArgs = false, name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") + @ExecFunction(name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue().size() - 1; i++) { @@ -255,7 +254,7 @@ public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLit /** * Executable arithmetic functions CharacterLength */ - @ExecFunction(varArgs = false, name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") public static Expression characterLength(VarcharLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -271,7 +270,7 @@ private static boolean isSeparator(char c) { /** * Executable arithmetic functions initCap */ - @ExecFunction(varArgs = false, name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression initCap(VarcharLiteral first) { StringBuilder result = new StringBuilder(first.getValue().length()); boolean capitalizeNext = true; @@ -293,7 +292,7 @@ public static Expression initCap(VarcharLiteral first) { /** * Executable arithmetic functions md5 */ - @ExecFunction(varArgs = false, name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression md5(VarcharLiteral first) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -476,7 +475,7 @@ private static int findStringInSet(String target, String input) { /** * Executable arithmetic functions find_in_set */ - @ExecFunction(varArgs = false, name = "find_in_set", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "find_in_set", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") public static Expression findInSetVarchar(VarcharLiteral first, VarcharLiteral second) { return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); } @@ -484,7 +483,7 @@ public static Expression findInSetVarchar(VarcharLiteral first, VarcharLiteral s /** * Executable arithmetic functions find_in_set */ - @ExecFunction(varArgs = false, name = "find_in_set", argTypes = {"STRING", "STRING"}, returnType = "INT") + @ExecFunction(name = "find_in_set", argTypes = {"STRING", "STRING"}, returnType = "INT") public static Expression findInSetString(StringLiteral first, StringLiteral second) { return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); } @@ -492,7 +491,7 @@ public static Expression findInSetString(StringLiteral first, StringLiteral seco /** * Executable arithmetic functions repeat */ - @ExecFunction(varArgs = false, name = "repeat", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "repeat", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression repeat(VarcharLiteral first, IntegerLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue(); i++) { @@ -504,7 +503,7 @@ public static Expression repeat(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions reverse */ - @ExecFunction(varArgs = false, name = "reverse", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "reverse", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression reverseVarchar(VarcharLiteral first) { StringBuilder sb = new StringBuilder(); sb.append(first.getValue()); @@ -514,7 +513,7 @@ public static Expression reverseVarchar(VarcharLiteral first) { /** * Executable arithmetic functions reverse */ - @ExecFunction(varArgs = false, name = "reverse", argTypes = {"STRING"}, returnType = "STRING") + @ExecFunction(name = "reverse", argTypes = {"STRING"}, returnType = "STRING") public static Expression reverseString(VarcharLiteral first) { StringBuilder sb = new StringBuilder(); sb.append(first.getValue()); @@ -524,7 +523,7 @@ public static Expression reverseString(VarcharLiteral first) { /** * Executable arithmetic functions space */ - @ExecFunction(varArgs = false, name = "space", argTypes = {"INT"}, returnType = "VARCHAR") + @ExecFunction(name = "space", argTypes = {"INT"}, returnType = "VARCHAR") public static Expression space(IntegerLiteral first) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < first.getValue(); i++) { @@ -536,8 +535,7 @@ public static Expression space(IntegerLiteral first) { /** * Executable arithmetic functions split_by_char */ - @ExecFunction(varArgs = false, name = "split_by_char", - argTypes = {"VARCHAR", "VARCHAR"}, returnType = "ARRAY") + @ExecFunction(name = "split_by_char", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "ARRAY") public static Expression splitByChar(VarcharLiteral first, VarcharLiteral second) { String[] result = first.getValue().split(second.getValue()); List items = new ArrayList<>(); @@ -550,8 +548,7 @@ public static Expression splitByChar(VarcharLiteral first, VarcharLiteral second /** * Executable arithmetic functions split_by_string */ - @ExecFunction(varArgs = false, name = "split_by_char", - argTypes = {"STRING", "STRING"}, returnType = "ARRAY") + @ExecFunction(name = "split_by_char", argTypes = {"STRING", "STRING"}, returnType = "ARRAY") public static Expression splitByString(StringLiteral first, StringLiteral second) { String[] result = first.getValue().split(second.getValue()); List items = new ArrayList<>(); @@ -564,8 +561,7 @@ public static Expression splitByString(StringLiteral first, StringLiteral second /** * Executable arithmetic functions split_part */ - @ExecFunction(varArgs = false, name = "split_part", - argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "split_part", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { if (literal.getValue().equals(chr.getValue())) { if (Math.abs(number.getValue()) == 1 || Math.abs(number.getValue()) == 2) { @@ -608,8 +604,7 @@ public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, I /** * Executable arithmetic functions substring_index */ - @ExecFunction(varArgs = false, name = "substring_index", - argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "substring_index", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { String[] parts = literal.getValue().split(chr.getValue()); if (Math.abs(number.getValue()) >= parts.length) { @@ -638,7 +633,7 @@ public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral c /** * Executable arithmetic functions strcmp */ - @ExecFunction(varArgs = false, name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") + @ExecFunction(name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { int result = first.getValue().compareTo(second.getValue()); if (result == 0) { @@ -653,7 +648,7 @@ public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions strLeft */ - @ExecFunction(varArgs = false, name = "strleft", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "strleft", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return new VarcharLiteral(""); @@ -667,7 +662,7 @@ public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions strRight */ - @ExecFunction(varArgs = false, name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return new VarcharLiteral(""); @@ -687,8 +682,7 @@ public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions overlay */ - @ExecFunction(varArgs = false, name = "overlay", - argTypes = {"VARCHAR", "INT", "INT", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "overlay", argTypes = {"VARCHAR", "INT", "INT", "VARCHAR"}, returnType = "VARCHAR") public static Expression overlay(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third, VarcharLiteral four) { StringBuilder sb = new StringBuilder(); @@ -712,7 +706,7 @@ public static Expression overlay(VarcharLiteral first, /** * Executable arithmetic functions parseurl */ - @ExecFunction(varArgs = false, name = "parse_url", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "parse_url", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression parseurl(VarcharLiteral first, VarcharLiteral second) { URI uri = null; try { @@ -767,7 +761,7 @@ public static Expression parseurl(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions urldecode */ - @ExecFunction(varArgs = false, name = "url_decode", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "url_decode", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression urlDecode(VarcharLiteral first) { try { return new VarcharLiteral(URLDecoder.decode(first.getValue(), StandardCharsets.UTF_8.name())); @@ -779,8 +773,7 @@ public static Expression urlDecode(VarcharLiteral first) { /** * Executable arithmetic functions append_trailing_char_if_absent */ - @ExecFunction(varArgs = false, name = "append_trailing_char_if_absent", - argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression appendTrailingCharIfAbsent(VarcharLiteral first, VarcharLiteral second) { if (first.getValue().endsWith(second.getValue())) { return first; @@ -792,7 +785,7 @@ public static Expression appendTrailingCharIfAbsent(VarcharLiteral first, Varcha /** * Executable arithmetic functions endsWith */ - @ExecFunction(varArgs = false, name = "ends_with", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "BOOLEAN") + @ExecFunction(name = "ends_with", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "BOOLEAN") public static Expression endsWith(VarcharLiteral first, VarcharLiteral second) { if (first.getValue().endsWith(second.getValue())) { return BooleanLiteral.TRUE; @@ -804,8 +797,7 @@ public static Expression endsWith(VarcharLiteral first, VarcharLiteral second) { /** * Executable arithmetic functions extractUrlParameter */ - @ExecFunction(varArgs = false, name = "extract_url_parameter", - argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "extract_url_parameter", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression extractUrlParameter(VarcharLiteral first, VarcharLiteral second) { if (first.getValue() == null || first.getValue().indexOf('?') == -1) { return new VarcharLiteral(""); @@ -829,7 +821,7 @@ public static Expression extractUrlParameter(VarcharLiteral first, VarcharLitera /** * Executable arithmetic functions quote */ - @ExecFunction(varArgs = false, name = "quote", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "quote", argTypes = {"VARCHAR"}, returnType = "VARCHAR") public static Expression quote(VarcharLiteral first) { return new VarcharLiteral("\'" + first.getValue() + "\'"); } @@ -837,8 +829,7 @@ public static Expression quote(VarcharLiteral first) { /** * Executable arithmetic functions replaceEmpty */ - @ExecFunction(varArgs = false, name = "replace_empty", - argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "replace_empty", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") public static Expression replaceEmpty(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { return new VarcharLiteral(first.getValue().replace(second.getValue(), third.getValue())); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java index 58682f5f03c626..3a98ee6252791a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java @@ -137,76 +137,73 @@ private static LocalDateTime getDateCeilOrFloor(DATE tag, LocalDateTime date, in /** * datetime arithmetic function year-ceil */ - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "year_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "year_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "year_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -215,76 +212,73 @@ public static Expression yearCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function month-ceil */ - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "month_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "month_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "month_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -293,76 +287,73 @@ public static Expression monthCeil(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function day-ceil */ - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "day_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "day_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "day_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -371,76 +362,73 @@ public static Expression dayCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-ceil */ - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "hour_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); @@ -449,76 +437,73 @@ public static Expression hourCeil(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function minute-ceil */ - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "minute_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -528,76 +513,73 @@ public static Expression minuteCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function SECOND-ceil */ - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "second_ceil", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondCeil(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondCeil(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, true)); } - @ExecFunction(varArgs = false, name = "second_ceil", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), true)); } - @ExecFunction(varArgs = false, name = "second_ceil", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_ceil", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), @@ -607,76 +589,73 @@ public static Expression secondCeil(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function year-floor */ - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "year_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "year_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression yearFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression yearFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "year_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "year_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "year_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.YEAR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -685,76 +664,73 @@ public static Expression yearFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function month-floor */ - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "month_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "month_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression monthFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression monthFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "month_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "month_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "month_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MONTH, date.toJavaDateType(), @@ -764,76 +740,73 @@ public static Expression monthFloor(DateTimeV2Literal date, IntegerLiteral perio /** * datetime arithmetic function day-floor */ - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "day_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "day_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression dayFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression dayFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "day_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "day_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "day_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.DAY, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -842,76 +815,73 @@ public static Expression dayFloor(DateTimeV2Literal date, IntegerLiteral period, /** * datetime arithmetic function hour-floor */ - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "hour_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression hourFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression hourFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "hour_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "hour_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hour_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.HOUR, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); @@ -920,76 +890,73 @@ public static Expression hourFloor(DateTimeV2Literal date, IntegerLiteral period /** * datetime arithmetic function minute-floor */ - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "minute_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression minuteFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression minuteFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "minute_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "minute_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minute_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.MINUTE, date.toJavaDateType(), @@ -999,76 +966,73 @@ public static Expression minuteFloor(DateTimeV2Literal date, IntegerLiteral peri /** * datetime arithmetic function SECOND-floor */ - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_floor", argTypes = {"DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "second_floor", - argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") + @ExecFunction(name = "second_floor", argTypes = {"DATETIME", "INT", "DATETIME"}, returnType = "DATETIME") public static Expression secondFloor(DateTimeLiteral date, IntegerLiteral period, DateTimeLiteral origin) { return DateTimeLiteral.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATEV2", "INT", "DATEV2"}, returnType = "DATEV2") public static Expression secondFloor(DateV2Literal date, IntegerLiteral period, DateV2Literal origin) { return DateV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), period.getValue(), START_ORIGINAL_DAY, false)); } - @ExecFunction(varArgs = false, name = "second_floor", - argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), 1, origin.toJavaDateType(), false)); } - @ExecFunction(varArgs = false, name = "second_floor", - argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "second_floor", argTypes = {"DATETIMEV2", "INT", "DATETIMEV2"}, returnType = "DATETIMEV2") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(), From bcce3bec259015af12c39be2d070f32d2c00c6be Mon Sep 17 00:00:00 2001 From: LiBinfeng <1204975323@qq.com> Date: Tue, 10 Sep 2024 22:01:48 +0800 Subject: [PATCH 7/8] support string also --- .../executable/StringArithmetic.java | 319 ++++++++++-------- .../expressions/functions/scalar/Repeat.java | 2 + .../fold_constant/fold_constant_by_be.out | Bin 13692 -> 132 bytes .../fold_constant/fold_constant_by_be.groovy | 1 + .../fold_constant_string_arithmatic.groovy | 309 +++++++++++++++++ 5 files changed, 481 insertions(+), 150 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 4fb057b8cc7f1f..4e947455481a36 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -17,6 +17,7 @@ package org.apache.doris.nereids.trees.expressions.functions.executable; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.ExecFunction; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.ArrayLiteral; @@ -33,6 +34,7 @@ import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.StringLikeLiteral; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; @@ -53,50 +55,64 @@ * concat */ public class StringArithmetic { + private static Expression castStringLikeLiteral(StringLikeLiteral first, String value) { + if (first instanceof StringLiteral) { + return new StringLiteral(value); + } else if (first instanceof VarcharLiteral) { + return castStringLikeLiteral(first, value); + } + throw new AnalysisException("Unsupported string literal type: " + first.getClass().getSimpleName()); + } + /** * Executable arithmetic functions concat */ @ExecFunction(name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression concatVarcharVarchar(VarcharLiteral first, VarcharLiteral second) { + public static Expression concatVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { String result = first.getValue() + second.getValue(); - return new VarcharLiteral(result); + return castStringLikeLiteral(first, result); } - /** - * Executable arithmetic functions substring - */ - @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") - public static Expression substringVarcharIntInt(VarcharLiteral first, IntegerLiteral second, IntegerLiteral third) { - int stringLength = first.getValue().length(); + private static String substringImpl(String first, int second, int third) { + int stringLength = first.length(); if (stringLength == 0) { - return new VarcharLiteral(""); + return ""; } int leftIndex = 0; - if (second.getValue() < (- stringLength)) { - return new VarcharLiteral(""); - } else if (second.getValue() < 0) { - leftIndex = stringLength + second.getValue(); - } else if (second.getValue() <= stringLength) { - leftIndex = second.getValue() - 1; + if (second < (- stringLength)) { + return ""; + } else if (second < 0) { + leftIndex = stringLength + second; + } else if (second <= stringLength) { + leftIndex = second - 1; } else { - return new VarcharLiteral(""); + return ""; } int rightIndex = 0; - if (third.getValue() <= 0) { - return new VarcharLiteral(""); - } else if ((third.getValue() + leftIndex) > stringLength) { + if (third <= 0) { + return ""; + } else if ((third + leftIndex) > stringLength) { rightIndex = stringLength; } else { - rightIndex = third.getValue() + leftIndex; + rightIndex = third + leftIndex; } - return new VarcharLiteral(first.getValue().substring(leftIndex, rightIndex)); + return first.substring(leftIndex, rightIndex); + } + + /** + * Executable arithmetic functions substring + */ + @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + public static Expression substringVarcharIntInt(StringLikeLiteral first, + IntegerLiteral second, IntegerLiteral third) { + return castStringLikeLiteral(first, substringImpl(first.getValue(), second.getValue(), third.getValue())); } /** * Executable arithmetic functions length */ @ExecFunction(name = "length", argTypes = {"VARCHAR"}, returnType = "INT") - public static Expression lengthVarchar(VarcharLiteral first) { + public static Expression lengthVarchar(StringLikeLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -104,62 +120,104 @@ public static Expression lengthVarchar(VarcharLiteral first) { * Executable arithmetic functions Lower */ @ExecFunction(name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression lowerVarchar(VarcharLiteral first) { - return new VarcharLiteral(first.getValue().toLowerCase()); + public static Expression lowerVarchar(StringLikeLiteral first) { + return castStringLikeLiteral(first, first.getValue().toLowerCase()); } /** * Executable arithmetic functions Upper */ @ExecFunction(name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression upperVarchar(VarcharLiteral first) { - return new VarcharLiteral(first.getValue().toUpperCase()); + public static Expression upperVarchar(StringLikeLiteral first) { + return castStringLikeLiteral(first, first.getValue().toUpperCase()); + } + + private static String trimImpl(String first, String second, boolean left, boolean right) { + String result = first; + String afterReplace = first; + if (left) { + do { + result = afterReplace; + afterReplace = result.replaceFirst("^" + second, ""); + } while (!afterReplace.equals(result)); + } + if (right) { + do { + result = afterReplace; + afterReplace = result.replaceFirst(second + "$", ""); + } while (!afterReplace.equals(result)); + } + return result; } /** * Executable arithmetic functions Trim */ @ExecFunction(name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression trimVarchar(VarcharLiteral first) { - return new VarcharLiteral(first.getValue().strip()); + public static Expression trimVarchar(StringLikeLiteral first) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", true, true)); + } + + /** + * Executable arithmetic functions Trim + */ + @ExecFunction(name = "trim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression trimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), true, true)); } /** - * Executable arithmetic functions LTrim + * Executable arithmetic functions ltrim */ @ExecFunction(name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression ltrimVarchar(VarcharLiteral first) { - return new VarcharLiteral(first.getValue().stripLeading()); + public static Expression ltrimVarchar(StringLikeLiteral first) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", true, false)); + } + + /** + * Executable arithmetic functions ltrim + */ + @ExecFunction(name = "ltrim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression ltrimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), true, false)); } /** - * Executable arithmetic functions RTrim + * Executable arithmetic functions rtrim */ @ExecFunction(name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression rtrimVarchar(VarcharLiteral first) { - return new VarcharLiteral(first.getValue().stripTrailing()); + public static Expression rtrimVarchar(StringLikeLiteral first) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", false, true)); + } + + /** + * Executable arithmetic functions rtrim + */ + @ExecFunction(name = "rtrim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + public static Expression rtrimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { + return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), false, true)); } /** * Executable arithmetic functions Replace */ @ExecFunction(name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression replace(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { + public static Expression replace(StringLikeLiteral first, StringLikeLiteral second, StringLikeLiteral third) { if (second.getValue().length() == 0) { - return new VarcharLiteral(first.getValue()); + return castStringLikeLiteral(first, first.getValue()); } - return new VarcharLiteral(first.getValue().replace(second.getValue(), third.getValue())); + return castStringLikeLiteral(first, first.getValue().replace(second.getValue(), third.getValue())); } /** * Executable arithmetic functions Left */ @ExecFunction(name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression left(VarcharLiteral first, IntegerLiteral second) { + public static Expression left(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } else if (second.getValue() < first.getValue().length()) { - return new VarcharLiteral(first.getValue().substring(0, second.getValue())); + return castStringLikeLiteral(first, first.getValue().substring(0, second.getValue())); } else { return first; } @@ -169,17 +227,17 @@ public static Expression left(VarcharLiteral first, IntegerLiteral second) { * Executable arithmetic functions Right */ @ExecFunction(name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression right(VarcharLiteral first, IntegerLiteral second) { + public static Expression right(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } else if (second.getValue() > first.getValue().length()) { return first; } else { if (second.getValue() > 0) { - return new VarcharLiteral(first.getValue().substring( + return castStringLikeLiteral(first, first.getValue().substring( first.getValue().length() - second.getValue(), first.getValue().length())); } else { - return new VarcharLiteral(first.getValue().substring( + return castStringLikeLiteral(first, first.getValue().substring( Math.abs(second.getValue()) - 1, first.getValue().length())); } } @@ -189,15 +247,15 @@ public static Expression right(VarcharLiteral first, IntegerLiteral second) { * Executable arithmetic functions Locate */ @ExecFunction(name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") - public static Expression locate(VarcharLiteral first, VarcharLiteral second) { - return new IntegerLiteral(second.getValue().strip().indexOf(first.getValue()) + 1); + public static Expression locate(StringLikeLiteral first, StringLikeLiteral second) { + return new IntegerLiteral(second.getValue().trim().indexOf(first.getValue()) + 1); } /** * Executable arithmetic functions Instr */ @ExecFunction(name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") - public static Expression instr(VarcharLiteral first, VarcharLiteral second) { + public static Expression instr(StringLikeLiteral first, StringLikeLiteral second) { return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); } @@ -205,7 +263,7 @@ public static Expression instr(VarcharLiteral first, VarcharLiteral second) { * Executable arithmetic functions Ascii */ @ExecFunction(name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") - public static Expression ascii(VarcharLiteral first) { + public static Expression ascii(StringLikeLiteral first) { if (first.getValue().length() == 0) { return new IntegerLiteral(0); } @@ -225,7 +283,7 @@ public static Expression bin(BigIntLiteral first) { * Executable arithmetic functions ConcatWs */ @ExecFunction(name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") - public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral second) { + public static Expression concatWsVarcharArray(StringLikeLiteral first, ArrayLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue().size() - 1; i++) { if (!(second.getValue().get(i) instanceof NullLiteral)) { @@ -234,28 +292,28 @@ public static Expression concatWsVarcharArray(VarcharLiteral first, ArrayLiteral } } sb.append(second.getValue().get(second.getValue().size() - 1).getValue()); - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } /** * Executable arithmetic functions ConcatWs */ @ExecFunction(varArgs = true, name = "concat_ws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression concatWsVarcharVarchar(VarcharLiteral first, VarcharLiteral... second) { + public static Expression concatWsVarcharVarchar(StringLikeLiteral first, VarcharLiteral... second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.length - 1; i++) { sb.append(second[i].getValue()); sb.append(first.getValue()); } sb.append(second[second.length - 1].getValue()); - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } /** * Executable arithmetic functions CharacterLength */ @ExecFunction(name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") - public static Expression characterLength(VarcharLiteral first) { + public static Expression characterLength(StringLikeLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -271,7 +329,7 @@ private static boolean isSeparator(char c) { * Executable arithmetic functions initCap */ @ExecFunction(name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression initCap(VarcharLiteral first) { + public static Expression initCap(StringLikeLiteral first) { StringBuilder result = new StringBuilder(first.getValue().length()); boolean capitalizeNext = true; @@ -286,19 +344,19 @@ public static Expression initCap(VarcharLiteral first) { result.append(Character.toLowerCase(c)); } } - return new VarcharLiteral(result.toString()); + return castStringLikeLiteral(first, result.toString()); } /** * Executable arithmetic functions md5 */ @ExecFunction(name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression md5(VarcharLiteral first) { + public static Expression md5(StringLikeLiteral first) { try { MessageDigest md = MessageDigest.getInstance("MD5"); // Update the digest with the input bytes md.update(first.getValue().getBytes()); - return new VarcharLiteral(bytesToHex(md.digest())); + return castStringLikeLiteral(first, bytesToHex(md.digest())); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } @@ -315,7 +373,7 @@ public static Expression md5Sum(VarcharLiteral... first) { // Step 2: Concatenate all strings in the list into one string StringBuilder combinedInput = new StringBuilder(); - for (VarcharLiteral input : first) { + for (StringLikeLiteral input : first) { combinedInput.append(input.getValue()); } @@ -333,7 +391,7 @@ public static Expression md5Sum(VarcharLiteral... first) { } // Step 5: Return the hexadecimal string - return new VarcharLiteral(hexString.toString()); + return castStringLikeLiteral(first[0], hexString.toString()); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); @@ -450,15 +508,7 @@ public static Expression fieldDateTimeV2(DateTimeV2Literal first, DateTimeV2Lite * Executable arithmetic functions field */ @ExecFunction(varArgs = true, name = "field", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") - public static Expression fieldVarchar(VarcharLiteral first, VarcharLiteral... second) { - return new IntegerLiteral(compareLiteral(first, second)); - } - - /** - * Executable arithmetic functions field - */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"STRING", "STRING"}, returnType = "INT") - public static Expression fieldString(StringLiteral first, StringLiteral... second) { + public static Expression fieldVarchar(StringLikeLiteral first, VarcharLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -476,15 +526,7 @@ private static int findStringInSet(String target, String input) { * Executable arithmetic functions find_in_set */ @ExecFunction(name = "find_in_set", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") - public static Expression findInSetVarchar(VarcharLiteral first, VarcharLiteral second) { - return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); - } - - /** - * Executable arithmetic functions find_in_set - */ - @ExecFunction(name = "find_in_set", argTypes = {"STRING", "STRING"}, returnType = "INT") - public static Expression findInSetString(StringLiteral first, StringLiteral second) { + public static Expression findInSetVarchar(StringLikeLiteral first, StringLikeLiteral second) { return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); } @@ -492,32 +534,22 @@ public static Expression findInSetString(StringLiteral first, StringLiteral seco * Executable arithmetic functions repeat */ @ExecFunction(name = "repeat", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression repeat(VarcharLiteral first, IntegerLiteral second) { + public static Expression repeat(StringLikeLiteral first, IntegerLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue(); i++) { sb.append(first.getValue()); } - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } /** * Executable arithmetic functions reverse */ @ExecFunction(name = "reverse", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression reverseVarchar(VarcharLiteral first) { - StringBuilder sb = new StringBuilder(); - sb.append(first.getValue()); - return new VarcharLiteral(sb.reverse().toString()); - } - - /** - * Executable arithmetic functions reverse - */ - @ExecFunction(name = "reverse", argTypes = {"STRING"}, returnType = "STRING") - public static Expression reverseString(VarcharLiteral first) { + public static Expression reverseVarchar(StringLikeLiteral first) { StringBuilder sb = new StringBuilder(); sb.append(first.getValue()); - return new VarcharLiteral(sb.reverse().toString()); + return castStringLikeLiteral(first, sb.reverse().toString()); } /** @@ -536,24 +568,11 @@ public static Expression space(IntegerLiteral first) { * Executable arithmetic functions split_by_char */ @ExecFunction(name = "split_by_char", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "ARRAY") - public static Expression splitByChar(VarcharLiteral first, VarcharLiteral second) { - String[] result = first.getValue().split(second.getValue()); - List items = new ArrayList<>(); - for (int i = 1; i < result.length; i++) { - items.add(new StringLiteral(result[i])); - } - return new ArrayLiteral(items); - } - - /** - * Executable arithmetic functions split_by_string - */ - @ExecFunction(name = "split_by_char", argTypes = {"STRING", "STRING"}, returnType = "ARRAY") - public static Expression splitByString(StringLiteral first, StringLiteral second) { + public static Expression splitByChar(StringLikeLiteral first, StringLikeLiteral second) { String[] result = first.getValue().split(second.getValue()); List items = new ArrayList<>(); for (int i = 1; i < result.length; i++) { - items.add(new StringLiteral(result[i])); + items.add((Literal) castStringLikeLiteral(first, result[i])); } return new ArrayLiteral(items); } @@ -562,42 +581,42 @@ public static Expression splitByString(StringLiteral first, StringLiteral second * Executable arithmetic functions split_part */ @ExecFunction(name = "split_part", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { - if (literal.getValue().equals(chr.getValue())) { + public static Expression splitPart(StringLikeLiteral first, StringLikeLiteral chr, IntegerLiteral number) { + if (first.getValue().equals(chr.getValue())) { if (Math.abs(number.getValue()) == 1 || Math.abs(number.getValue()) == 2) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } } String separator = chr.getValue(); String[] parts = null; if (number.getValue() < 0) { - StringBuilder sb = new StringBuilder(literal.getValue()); + StringBuilder sb = new StringBuilder(first.getValue()); StringBuilder seperatorBuilder = new StringBuilder(separator); separator = seperatorBuilder.reverse().toString(); - if (".$|()[{^?*+\\".indexOf(separator) != -1 || separator.startsWith("\\")) { + if (".$|()[{^?*+\\".contains(separator) || separator.startsWith("\\")) { separator = "\\" + separator; } parts = sb.reverse().toString().split(separator); } else { - if (".$|()[{^?*+\\".indexOf(separator) != -1 || separator.startsWith("\\")) { + if (".$|()[{^?*+\\".contains(separator) || separator.startsWith("\\")) { separator = "\\" + separator; } - parts = literal.getValue().split(separator); + parts = first.getValue().split(separator); } if (parts.length < Math.abs(number.getValue()) || number.getValue() == 0) { if (parts.length == Math.abs(number.getValue()) - 1) { - if (number.getValue() < 0 && literal.getValue().startsWith(chr.getValue()) - || number.getValue() > 0 && literal.getValue().endsWith(chr.getValue())) { - return new VarcharLiteral(""); + if (number.getValue() < 0 && first.getValue().startsWith(chr.getValue()) + || number.getValue() > 0 && first.getValue().endsWith(chr.getValue())) { + return castStringLikeLiteral(first, ""); } } return new NullLiteral(); } else if (number.getValue() < 0) { StringBuilder result = new StringBuilder(parts[Math.abs(number.getValue()) - 1]); - return new VarcharLiteral(result.reverse().toString()); + return castStringLikeLiteral(first, result.reverse().toString()); } else { - return new VarcharLiteral(parts[number.getValue() - 1]); + return castStringLikeLiteral(first, parts[number.getValue() - 1]); } } @@ -605,15 +624,15 @@ public static Expression splitPart(VarcharLiteral literal, VarcharLiteral chr, I * Executable arithmetic functions substring_index */ @ExecFunction(name = "substring_index", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral chr, IntegerLiteral number) { - String[] parts = literal.getValue().split(chr.getValue()); + public static Expression substringIndex(StringLikeLiteral first, StringLikeLiteral chr, IntegerLiteral number) { + String[] parts = first.getValue().split(chr.getValue()); if (Math.abs(number.getValue()) >= parts.length) { - return literal; + return first; } int leftIndex; int rightIndex; if (parts.length < number.getValue() || number.getValue() < (- parts.length) || number.getValue() == 0) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } else if (number.getValue() < 0) { leftIndex = parts.length + number.getValue(); rightIndex = parts.length; @@ -627,14 +646,14 @@ public static Expression substringIndex(VarcharLiteral literal, VarcharLiteral c sb.append(chr.getValue()); } sb.append(parts[rightIndex - 1]); - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } /** * Executable arithmetic functions strcmp */ @ExecFunction(name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") - public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { + public static Expression strcmp(StringLikeLiteral first, StringLikeLiteral second) { int result = first.getValue().compareTo(second.getValue()); if (result == 0) { return new TinyIntLiteral((byte) 0); @@ -649,13 +668,13 @@ public static Expression strcmp(VarcharLiteral first, VarcharLiteral second) { * Executable arithmetic functions strLeft */ @ExecFunction(name = "strleft", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { + public static Expression strLeft(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } else if (second.getValue() > first.getValue().length()) { return first; } else { - return new VarcharLiteral(first.getValue().substring(0, second.getValue())); + return castStringLikeLiteral(first, first.getValue().substring(0, second.getValue())); } } @@ -663,17 +682,17 @@ public static Expression strLeft(VarcharLiteral first, IntegerLiteral second) { * Executable arithmetic functions strRight */ @ExecFunction(name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") - public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { + public static Expression strRight(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } else if (second.getValue() > first.getValue().length()) { return first; } else { if (second.getValue() > 0) { - return new VarcharLiteral(first.getValue().substring( + return castStringLikeLiteral(first, first.getValue().substring( first.getValue().length() - second.getValue(), first.getValue().length())); } else { - return new VarcharLiteral(first.getValue().substring( + return castStringLikeLiteral(first, first.getValue().substring( Math.abs(second.getValue()) - 1, first.getValue().length())); } } @@ -683,8 +702,8 @@ public static Expression strRight(VarcharLiteral first, IntegerLiteral second) { * Executable arithmetic functions overlay */ @ExecFunction(name = "overlay", argTypes = {"VARCHAR", "INT", "INT", "VARCHAR"}, returnType = "VARCHAR") - public static Expression overlay(VarcharLiteral first, - IntegerLiteral second, IntegerLiteral third, VarcharLiteral four) { + public static Expression overlay(StringLikeLiteral first, + IntegerLiteral second, IntegerLiteral third, StringLikeLiteral four) { StringBuilder sb = new StringBuilder(); if (second.getValue() <= 0 || second.getValue() > first.getValue().length()) { return first; @@ -692,13 +711,13 @@ public static Expression overlay(VarcharLiteral first, if (third.getValue() < 0 || third.getValue() > (first.getValue().length() - third.getValue())) { sb.append(first.getValue().substring(0, second.getValue() - 1)); sb.append(four.getValue()); - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } else { sb.append(first.getValue().substring(0, second.getValue() - 1)); sb.append(four.getValue()); sb.append(first.getValue().substring(second.getValue() + third.getValue() - 1, first.getValue().length())); - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } } } @@ -707,7 +726,7 @@ public static Expression overlay(VarcharLiteral first, * Executable arithmetic functions parseurl */ @ExecFunction(name = "parse_url", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression parseurl(VarcharLiteral first, VarcharLiteral second) { + public static Expression parseurl(StringLikeLiteral first, StringLikeLiteral second) { URI uri = null; try { uri = new URI(first.getValue()); @@ -755,16 +774,16 @@ public static Expression parseurl(VarcharLiteral first, VarcharLiteral second) { throw new RuntimeException("Valid URL parts are 'PROTOCOL', 'HOST', " + "'PATH', 'REF', 'AUTHORITY', 'FILE', 'USERINFO', 'PORT' and 'QUERY'"); } - return new VarcharLiteral(sb.toString()); + return castStringLikeLiteral(first, sb.toString()); } /** * Executable arithmetic functions urldecode */ @ExecFunction(name = "url_decode", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression urlDecode(VarcharLiteral first) { + public static Expression urlDecode(StringLikeLiteral first) { try { - return new VarcharLiteral(URLDecoder.decode(first.getValue(), StandardCharsets.UTF_8.name())); + return castStringLikeLiteral(first, URLDecoder.decode(first.getValue(), StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } @@ -774,11 +793,11 @@ public static Expression urlDecode(VarcharLiteral first) { * Executable arithmetic functions append_trailing_char_if_absent */ @ExecFunction(name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression appendTrailingCharIfAbsent(VarcharLiteral first, VarcharLiteral second) { + public static Expression appendTrailingCharIfAbsent(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue().endsWith(second.getValue())) { return first; } else { - return new VarcharLiteral(first.getValue() + second.getValue()); + return castStringLikeLiteral(first, first.getValue() + second.getValue()); } } @@ -786,7 +805,7 @@ public static Expression appendTrailingCharIfAbsent(VarcharLiteral first, Varcha * Executable arithmetic functions endsWith */ @ExecFunction(name = "ends_with", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "BOOLEAN") - public static Expression endsWith(VarcharLiteral first, VarcharLiteral second) { + public static Expression endsWith(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue().endsWith(second.getValue())) { return BooleanLiteral.TRUE; } else { @@ -798,9 +817,9 @@ public static Expression endsWith(VarcharLiteral first, VarcharLiteral second) { * Executable arithmetic functions extractUrlParameter */ @ExecFunction(name = "extract_url_parameter", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression extractUrlParameter(VarcharLiteral first, VarcharLiteral second) { + public static Expression extractUrlParameter(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue() == null || first.getValue().indexOf('?') == -1) { - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } String[] urlParts = first.getValue().split("\\?"); @@ -811,27 +830,27 @@ public static Expression extractUrlParameter(VarcharLiteral first, VarcharLitera for (String pair : pairs) { String[] keyValue = pair.split("="); if (second.getValue().equals(keyValue[0])) { - return new VarcharLiteral(keyValue[1]); + return castStringLikeLiteral(first, keyValue[1]); } } } - return new VarcharLiteral(""); + return castStringLikeLiteral(first, ""); } /** * Executable arithmetic functions quote */ @ExecFunction(name = "quote", argTypes = {"VARCHAR"}, returnType = "VARCHAR") - public static Expression quote(VarcharLiteral first) { - return new VarcharLiteral("\'" + first.getValue() + "\'"); + public static Expression quote(StringLikeLiteral first) { + return castStringLikeLiteral(first, "\'" + first.getValue() + "\'"); } /** * Executable arithmetic functions replaceEmpty */ @ExecFunction(name = "replace_empty", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") - public static Expression replaceEmpty(VarcharLiteral first, VarcharLiteral second, VarcharLiteral third) { - return new VarcharLiteral(first.getValue().replace(second.getValue(), third.getValue())); + public static Expression replaceEmpty(StringLikeLiteral first, StringLikeLiteral second, StringLikeLiteral third) { + return castStringLikeLiteral(first, first.getValue().replace(second.getValue(), third.getValue())); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Repeat.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Repeat.java index b85a812197f55b..5ed3b20ddb465b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Repeat.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Repeat.java @@ -25,6 +25,7 @@ import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; import org.apache.doris.nereids.types.IntegerType; import org.apache.doris.nereids.types.StringType; +import org.apache.doris.nereids.types.VarcharType; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -38,6 +39,7 @@ public class Repeat extends ScalarFunction implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( + FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(VarcharType.SYSTEM_DEFAULT, IntegerType.INSTANCE), FunctionSignature.ret(StringType.INSTANCE).args(StringType.INSTANCE, IntegerType.INSTANCE) ); diff --git a/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out b/regression-test/data/nereids_p0/expression/fold_constant/fold_constant_by_be.out index 5a8af5458cf2413888994f4dafa496da46b556e0..c7c506292a5423bcb7458acc19ca75ed20782437 100644 GIT binary patch delta 19 acmey9)xtQTf~PP?L06Znq^LBNiwgirF$OgN literal 13692 zcmeI3-EN~s6vun*r#MWXEp!ns0)f z$EWOLde5?DdY{DX*LAvO+hvfmooI|#F0;ya4{el`;OKGwC@)pw$Fo#jP*{NZks*{o`9iR*MaZypzR z>G*@m&~b-9JB89Id))M<&Os~afH)Kw=m98Ip(59zk*g}Tw5uvAVgnknv@C0WOS9(d z;!qq+Fo%nQ>w4^iH*wGCm400uibEI9;h@Jr3&TO28K?~l^;4CQhpLGln1wjiQLc)o z@=z@LU=|gL!6&}irE5;LFdp@xXsF7|a1f<{>lP~9FA{Z%l`LH5!6wn7HY8fOfWhAI zPyz;9!>&m!#a$DZW4H@c6_ws#R*1p{4!3>h=k($hns8ymUEW`R{y{J9LKH4=xTVt+ z&5)J8tZ4M&uW7?!fV(+|Ui1zw_Zrx<9n4J*4er!PU%%AFp$c9DyEZ9Qm7o`gYS-Y3 zWg4nthE~w;huqS*zThUk{_w0~95S%)`ybh>th|q|gPo&vR4eHtdL{K#9;$wHxTmbK zpogL^4hI74F*RzJ6B;gHu)92zfZ?vPtfu`RqUBx_h^qj&zf6;aU(mx)$wCEhfPJRK zz7q?*;44|U;K7bFyGvI2JlxHrWw1GxPNWki1t;N2B)$H&!=Uo)ljW~S#X$nQ(JRTe zrR#6Y(+ncTbr89A>2?DncBl=QM) zp8S#d20K6L@SY4Aa2FVaQOpgba6gVyICy{bBbzy>#!T;rjgx+}>vh z0tI0Xg*qGxu>XsBl*W7>Wb;qKro1BTn&hqnzbFz12J8~~`ZJhtb+cOM$CAi~VRo%v zpWcP?SHLs9$YCLhjjSaV1*w?l7}sBtC>n~nuFba6!h#xq88yEaH5;D1o>CmK z)lhTH%^z2rnyu}l{u{+DJ*|f3@tf Date: Wed, 11 Sep 2024 11:41:56 +0800 Subject: [PATCH 8/8] fix comment --- .../expressions/functions/executable/StringArithmetic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java index 4e947455481a36..6f2ff11ad9a139 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java @@ -59,7 +59,7 @@ private static Expression castStringLikeLiteral(StringLikeLiteral first, String if (first instanceof StringLiteral) { return new StringLiteral(value); } else if (first instanceof VarcharLiteral) { - return castStringLikeLiteral(first, value); + return new VarcharLiteral(value); } throw new AnalysisException("Unsupported string literal type: " + first.getClass().getSimpleName()); }