From ffa96082221834089577bbc05e171e74b3f2b2b1 Mon Sep 17 00:00:00 2001 From: LiBinfeng <46676950+LiBinfeng-01@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:29:01 +0800 Subject: [PATCH] [Refactor](Nereids) refactor fold constant framework on fe (#40772) change matching of function by notation to matching by inputs datatype --- .../trees/expressions/ExecFunction.java | 14 - .../expressions/ExpressionEvaluator.java | 205 ++++--------- .../functions/executable/DateTimeAcquire.java | 24 +- .../executable/DateTimeArithmetic.java | 122 ++++---- .../DateTimeExtractAndTransform.java | 276 ++++++++--------- .../executable/ExecutableFunctions.java | 26 +- .../executable/NumericArithmetic.java | 174 +++++------ .../executable/StringArithmetic.java | 108 +++---- .../functions/executable/TimeRoundSeries.java | 288 +++++++++--------- 9 files changed, 573 insertions(+), 664 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 126449f4b04e34..a5c656d5ffa185 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 @@ -34,18 +34,4 @@ */ String name(); - /** - * args type - */ - String[] argTypes(); - - /** - * return type - */ - String returnType(); - - /** - * hasVarArgsc - */ - boolean varArgs() default false; } 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 f3d471b2abedc4..0c612e42ddaf11 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,8 +18,6 @@ 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; import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeAcquire; @@ -30,10 +28,10 @@ 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.DateTimeLiteral; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; 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; @@ -41,7 +39,6 @@ import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -52,7 +49,7 @@ public enum ExpressionEvaluator { INSTANCE; - private ImmutableMultimap functions; + private ImmutableMultimap functions; ExpressionEvaluator() { registerFunctions(); @@ -68,23 +65,16 @@ public Expression eval(Expression expression) { } String fnName = null; - DataType[] args = null; DataType ret = expression.getDataType(); if (expression instanceof BinaryArithmetic) { BinaryArithmetic arithmetic = (BinaryArithmetic) expression; fnName = arithmetic.getLegacyOperator().getName(); - args = new DataType[]{arithmetic.left().getDataType(), arithmetic.right().getDataType()}; } else if (expression instanceof TimestampArithmetic) { TimestampArithmetic arithmetic = (TimestampArithmetic) expression; fnName = arithmetic.getFuncName(); - args = new DataType[]{arithmetic.left().getDataType(), arithmetic.right().getDataType()}; } else if (expression instanceof BoundFunction) { BoundFunction function = ((BoundFunction) expression); fnName = function.getName(); - args = new DataType[function.arity()]; - for (int i = 0; i < function.children().size(); i++) { - args[i] = function.child(i).getDataType(); - } } if ((Env.getCurrentEnv().isNullResultWithOneNullParamFunction(fnName))) { @@ -95,22 +85,26 @@ public Expression eval(Expression expression) { } } - return invoke(expression, fnName, args); + return invoke(expression, fnName); } - private Expression invoke(Expression expression, String fnName, DataType[] args) { - FunctionSignature signature = new FunctionSignature(fnName, args, null, false); - FunctionInvoker invoker = getFunction(signature); - if (invoker != null) { + private Expression invoke(Expression expression, String fnName) { + Method method = getFunction(fnName, expression.children()); + if (method != 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]; + int varSize = method.getParameterTypes().length; + if (varSize == 0) { + return (Literal) method.invoke(null, expression.children().toArray()); + } + boolean hasVarArgs = method.getParameterTypes()[varSize - 1].isArray(); + if (hasVarArgs) { + int fixedArgsSize = varSize - 1; + int inputSize = expression.children().size(); + Class[] parameterTypes = method.getParameterTypes(); + Class parameterType = parameterTypes[varSize - 1]; Class componentType = parameterType.getComponentType(); - Object varArgs = Array.newInstance(componentType, totalSize - fixedArgsSize); - for (int i = fixedArgsSize; i < totalSize; i++) { + Object varArgs = Array.newInstance(componentType, inputSize - fixedArgsSize); + for (int i = fixedArgsSize; i < inputSize; i++) { if (!(expression.children().get(i) instanceof NullLiteral)) { Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); } @@ -121,59 +115,70 @@ private Expression invoke(Expression expression, String fnName, DataType[] args) } objects[fixedArgsSize] = varArgs; - return invoker.invokeVars(objects); + return (Literal) method.invoke(null, varArgs); } - return invoker.invoke(expression.children()); - } catch (AnalysisException e) { + return (Literal) method.invoke(null, expression.children().toArray()); + } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { return expression; } } return expression; } - private FunctionInvoker getFunction(FunctionSignature signature) { - Collection functionInvokers = functions.get(signature.getName()); - for (FunctionInvoker candidate : functionInvokers) { - DataType[] candidateTypes = candidate.getSignature().getArgTypes(); - DataType[] expectedTypes = signature.getArgTypes(); + private boolean canDownCastTo(Class expect, Class input) { + if (DateLiteral.class.isAssignableFrom(expect) + || DateTimeLiteral.class.isAssignableFrom(expect)) { + return expect.equals(input); + } + return expect.isAssignableFrom(input); + } - if (candidate.getSignature().hasVarArgs()) { - if (candidateTypes.length > expectedTypes.length) { + private Method getFunction(String fnName, List inputs) { + Collection expectMethods = functions.get(fnName); + for (Method expect : expectMethods) { + boolean match = true; + int varSize = expect.getParameterTypes().length; + if (varSize == 0) { + if (inputs.size() == 0) { + return expect; + } else { continue; } - boolean match = true; - for (int i = 0; i < candidateTypes.length - 1; i++) { - if (!(expectedTypes[i].toCatalogDataType().matchesType(candidateTypes[i].toCatalogDataType()))) { + } + boolean hasVarArgs = expect.getParameterTypes()[varSize - 1].isArray(); + if (hasVarArgs) { + int fixedArgsSize = varSize - 1; + int inputSize = inputs.size(); + if (inputSize <= fixedArgsSize) { + continue; + } + Class[] expectVarTypes = expect.getParameterTypes(); + for (int i = 0; i < fixedArgsSize; i++) { + if (!canDownCastTo(expectVarTypes[i], inputs.get(i).getClass())) { 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))) { + Class varArgsType = expectVarTypes[varSize - 1]; + Class varArgType = varArgsType.getComponentType(); + for (int i = fixedArgsSize; i < inputSize; i++) { + if (!canDownCastTo(varArgType, inputs.get(i).getClass())) { match = false; - break; } } - if (match) { - return candidate; - } else { + } else { + int inputSize = inputs.size(); + if (inputSize != varSize) { 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()))) { - match = false; - break; + Class[] expectVarTypes = expect.getParameterTypes(); + for (int i = 0; i < varSize; i++) { + if (!canDownCastTo(expectVarTypes[i], inputs.get(i).getClass())) { + match = false; + } } } if (match) { - return candidate; + return expect; } } return null; @@ -183,7 +188,7 @@ private void registerFunctions() { if (functions != null) { return; } - ImmutableMultimap.Builder mapBuilder = new ImmutableMultimap.Builder<>(); + ImmutableMultimap.Builder mapBuilder = new ImmutableMultimap.Builder<>(); List> classes = ImmutableList.of( DateTimeAcquire.class, DateTimeExtractAndTransform.class, @@ -208,92 +213,10 @@ private void registerFunctions() { this.functions = mapBuilder.build(); } - private void registerFEFunction(ImmutableMultimap.Builder mapBuilder, + private void registerFEFunction(ImmutableMultimap.Builder mapBuilder, Method method, ExecFunction annotation) { if (annotation != null) { - String name = annotation.name(); - DataType returnType = DataType.convertFromString(annotation.returnType()); - List argTypes = new ArrayList<>(); - for (String type : annotation.argTypes()) { - argTypes.add(TypeCoercionUtils.replaceDecimalV3WithWildcard(DataType.convertFromString(type))); - } - DataType[] array = new DataType[argTypes.size()]; - for (int i = 0; i < argTypes.size(); i++) { - array[i] = argTypes.get(i); - } - FunctionSignature signature = new FunctionSignature(name, array, returnType, annotation.varArgs()); - mapBuilder.put(name, new FunctionInvoker(method, signature)); - } - } - - /** - * function invoker. - */ - public static class FunctionInvoker { - private final Method method; - private final FunctionSignature signature; - - public FunctionInvoker(Method method, FunctionSignature signature) { - this.method = method; - this.signature = signature; - } - - public Method getMethod() { - return method; - } - - public FunctionSignature getSignature() { - return signature; - } - - public Literal invoke(List args) throws AnalysisException { - try { - return (Literal) method.invoke(null, args.toArray()); - } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { - 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()); - } + mapBuilder.put(annotation.name(), method); } } - - /** - * function signature. - */ - 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, boolean hasVarArgs) { - this.name = name; - this.argTypes = argTypes; - this.returnType = returnType; - this.hasVarArgs = hasVarArgs; - } - - public DataType[] getArgTypes() { - return argTypes; - } - - public DataType getReturnType() { - return returnType; - } - - 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..98d2ebfaf769ba 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(name = "now") public static Expression now() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "now", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "now") 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(name = "current_timestamp") public static Expression currentTimestamp() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "current_timestamp", argTypes = {"INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "current_timestamp") 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(name = "localtime") public static Expression localTime() { return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "localtimestamp", argTypes = {}, returnType = "DATETIME") + @ExecFunction(name = "localtimestamp") 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(name = "curdate") public static Expression curDate() { return DateLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); } - @ExecFunction(name = "current_date", argTypes = {}, returnType = "DATE") + @ExecFunction(name = "current_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(name = "curtime") // public static Expression curTime() { // return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone())); // } - // @ExecFunction(name = "current_time", argTypes = {}, returnType = "TIME") + // @ExecFunction(name = "current_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(name = "unix_timestamp") 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(name = "utc_timestamp") 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..15588871016b1f 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(name = "date_add") public static Expression dateAdd(DateLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "date_add") public static Expression dateAdd(DateTimeLiteral date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "date_add") public static Expression dateAdd(DateV2Literal date, IntegerLiteral day) { return daysAdd(date, day); } - @ExecFunction(name = "date_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "date_add") 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(name = "date_sub") 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(name = "date_sub") 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(name = "date_sub") 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(name = "date_sub") 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(name = "years_add") public static Expression yearsAdd(DateLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "years_add") public static Expression yearsAdd(DateTimeLiteral date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "years_add") public static Expression yearsAdd(DateV2Literal date, IntegerLiteral year) { return date.plusYears(year.getValue()); } - @ExecFunction(name = "years_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "years_add") 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(name = "months_add") public static Expression monthsAdd(DateLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "months_add") public static Expression monthsAdd(DateTimeLiteral date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "months_add") public static Expression monthsAdd(DateV2Literal date, IntegerLiteral month) { return date.plusMonths(month.getValue()); } - @ExecFunction(name = "months_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "months_add") 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(name = "weeks_add") public static Expression weeksAdd(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "weeks_add") public static Expression weeksAdd(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "weeks_add") public static Expression weeksAdd(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(weeks.getValue()); } - @ExecFunction(name = "weeks_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "weeks_add") 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(name = "days_add") public static Expression daysAdd(DateLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "days_add") public static Expression daysAdd(DateTimeLiteral date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "days_add") public static Expression daysAdd(DateV2Literal date, IntegerLiteral day) { return date.plusDays(day.getValue()); } - @ExecFunction(name = "days_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "days_add") 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(name = "hours_add") public static Expression hoursAdd(DateTimeLiteral date, IntegerLiteral hour) { return date.plusHours(hour.getValue()); } - @ExecFunction(name = "hours_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "hours_add") 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(name = "minutes_add") public static Expression minutesAdd(DateTimeLiteral date, IntegerLiteral minute) { return date.plusMinutes(minute.getValue()); } - @ExecFunction(name = "minutes_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "minutes_add") 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(name = "seconds_add") public static Expression secondsAdd(DateTimeLiteral date, IntegerLiteral second) { return date.plusSeconds(second.getValue()); } - @ExecFunction(name = "seconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "seconds_add") 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(name = "microseconds_add") 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(name = "microseconds_sub") 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(name = "milliseconds_add") 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(name = "milliseconds_sub") 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(name = "years_sub") 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(name = "years_sub") 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(name = "years_sub") 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(name = "years_sub") 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(name = "months_sub") 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(name = "months_sub") 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(name = "months_sub") 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(name = "months_sub") 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(name = "weeks_sub") public static Expression weeksSub(DateLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATETIME", "INT"}, returnType = "DATETIME") + @ExecFunction(name = "weeks_sub") public static Expression weeksSub(DateTimeLiteral date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATEV2", "INT"}, returnType = "DATEV2") + @ExecFunction(name = "weeks_sub") public static Expression weeksSub(DateV2Literal date, IntegerLiteral weeks) { return date.plusWeeks(-weeks.getValue()); } - @ExecFunction(name = "weeks_sub", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "weeks_sub") 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(name = "days_sub") 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(name = "days_sub") 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(name = "days_sub") 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(name = "days_sub") 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(name = "hours_sub") 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(name = "hours_sub") 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(name = "minutes_sub") 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(name = "minutes_sub") 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(name = "seconds_sub") 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(name = "seconds_sub") 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(name = "datediff") 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(name = "datediff") 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(name = "datediff") 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(name = "datediff") 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(name = "datediff") 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..440f93cac598a2 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(name = "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(name = "year") public static Expression year(DateLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(name = "year") public static Expression year(DateTimeLiteral date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "year") public static Expression year(DateV2Literal date) { return new SmallIntLiteral(((short) date.getYear())); } - @ExecFunction(name = "year", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "year") 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(name = "quarter") public static Expression quarter(DateLiteral date) { return new TinyIntLiteral((byte) (((byte) date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "quarter") public static Expression quarter(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "quarter") public static Expression quarter(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.getMonth() - 1) / 3 + 1)); } - @ExecFunction(name = "quarter", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "quarter") 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(name = "month") public static Expression month(DateLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "month") public static Expression month(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "month") public static Expression month(DateV2Literal date) { return new TinyIntLiteral((byte) date.getMonth()); } - @ExecFunction(name = "month", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "month") 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(name = "day") public static Expression day(DateLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "day") public static Expression day(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "day") public static Expression day(DateV2Literal date) { return new TinyIntLiteral((byte) date.getDay()); } - @ExecFunction(name = "day", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "day") 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(name = "hour") public static Expression hour(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getHour())); } - @ExecFunction(name = "hour", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "hour") 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(name = "minute") public static Expression minute(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getMinute())); } - @ExecFunction(name = "minute", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "minute") 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(name = "second") public static Expression second(DateTimeLiteral date) { return new TinyIntLiteral(((byte) date.getSecond())); } - @ExecFunction(name = "second", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "second") 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(name = "microsecond") 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(name = "dayofyear") public static Expression dayOfYear(DateLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATETIME"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear") public static Expression dayOfYear(DateTimeLiteral date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear") public static Expression dayOfYear(DateV2Literal date) { return new SmallIntLiteral((short) date.getDayOfYear()); } - @ExecFunction(name = "dayofyear", argTypes = {"DATETIMEV2"}, returnType = "SMALLINT") + @ExecFunction(name = "dayofyear") 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(name = "dayofmonth") public static Expression dayOfMonth(DateLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth") public static Expression dayOfMonth(DateTimeLiteral date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth") public static Expression dayOfMonth(DateV2Literal date) { return new TinyIntLiteral((byte) date.toJavaDateType().getDayOfMonth()); } - @ExecFunction(name = "dayofmonth", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofmonth") 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(name = "dayofweek") public static Expression dayOfWeek(DateLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek") public static Expression dayOfWeek(DateTimeLiteral date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek") public static Expression dayOfWeek(DateV2Literal date) { return new TinyIntLiteral((byte) (date.getDayOfWeek() % 7 + 1)); } - @ExecFunction(name = "dayofweek", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "dayofweek") 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(name = "date_format") 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(name = "date_format") 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(name = "date_format") 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(name = "date_format") 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(name = "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(name = "date") 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(name = "date_trunc") 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(name = "date_trunc") 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(name = "date_trunc") 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(name = "date_trunc") 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(name = "from_days") 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(name = "last_day") 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(name = "last_day") 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(name = "last_day") 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(name = "last_day") 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(name = "to_monday") public static Expression toMonday(DateLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATETIME"}, returnType = "DATE") + @ExecFunction(name = "to_monday") public static Expression toMonday(DateTimeLiteral date) { return DateLiteral.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATEV2"}, returnType = "DATEV2") + @ExecFunction(name = "to_monday") public static Expression toMonday(DateV2Literal date) { return DateV2Literal.fromJavaDateType(toMonday(date.toJavaDateType())); } - @ExecFunction(name = "to_monday", argTypes = {"DATETIMEV2"}, returnType = "DATEV2") + @ExecFunction(name = "to_monday") 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(name = "from_unixtime") 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(name = "from_unixtime") 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(name = "unix_timestamp") public static Expression unixTimestamp(DateLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(name = "unix_timestamp", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(name = "unix_timestamp") public static Expression unixTimestamp(DateTimeLiteral date) { return new IntegerLiteral(Integer.parseInt(getTimestamp(date.toJavaDateType()))); } - @ExecFunction(name = "unix_timestamp", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(name = "unix_timestamp") 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(name = "unix_timestamp") 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(name = "unix_timestamp") 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(name = "to_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(name = "to_date") 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(name = "to_days") 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(name = "to_days") 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(name = "to_days") 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(name = "to_days") 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(name = "makedate") 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(name = "str_to_date") 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(name = "timestamp") public static Expression timestamp(DateTimeLiteral datetime) { return datetime; } - @ExecFunction(name = "timestamp", argTypes = {"DATETIMEV2"}, returnType = "DATETIMEV2") + @ExecFunction(name = "timestamp") 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(name = "convert_tz") 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(name = "weekday") public static Expression weekDay(DateLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "weekday") public static Expression weekDay(DateTimeLiteral date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekday") public static Expression weekDay(DateV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "weekday", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "weekday") public static Expression weekDay(DateTimeV2Literal date) { return new TinyIntLiteral((byte) ((date.toJavaDateType().getDayOfWeek().getValue() + 6) % 7)); } - @ExecFunction(name = "week", argTypes = {"DATETIMEV2"}, returnType = "TINYINT") + @ExecFunction(name = "week") public static Expression week(DateTimeV2Literal dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATETIMEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week") public static Expression week(DateTimeV2Literal dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "week", argTypes = {"DATETIME"}, returnType = "TINYINT") + @ExecFunction(name = "week") public static Expression week(DateTimeLiteral dateTime) { return week(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATETIME", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week") public static Expression week(DateTimeLiteral dateTime, IntegerLiteral mode) { return week(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "week", argTypes = {"DATEV2"}, returnType = "TINYINT") + @ExecFunction(name = "week") public static Expression week(DateV2Literal date) { return week(date.toJavaDateType(), 0); } - @ExecFunction(name = "week", argTypes = {"DATEV2", "INT"}, returnType = "TINYINT") + @ExecFunction(name = "week") 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(name = "yearweek") public static Expression yearWeek(DateV2Literal date, IntegerLiteral mode) { return yearWeek(date.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2", "INT"}, returnType = "INT") + @ExecFunction(name = "yearweek") public static Expression yearWeek(DateTimeV2Literal dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIME", "INT"}, returnType = "INT") + @ExecFunction(name = "yearweek") public static Expression yearWeek(DateTimeLiteral dateTime, IntegerLiteral mode) { return yearWeek(dateTime.toJavaDateType(), mode.getIntValue()); } - @ExecFunction(name = "yearweek", argTypes = {"DATEV2"}, returnType = "INT") + @ExecFunction(name = "yearweek") public static Expression yearWeek(DateV2Literal date) { return yearWeek(date.toJavaDateType(), 0); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "yearweek") public static Expression yearWeek(DateTimeV2Literal dateTime) { return yearWeek(dateTime.toJavaDateType(), 0); } - @ExecFunction(name = "yearweek", argTypes = {"DATETIME"}, returnType = "INT") + @ExecFunction(name = "yearweek") 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(name = "weekofyear") 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(name = "weekofyear") 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(name = "weekofyear") 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(name = "dayname") 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(name = "dayname") 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(name = "dayname") 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(name = "monthname") 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(name = "monthname") 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(name = "monthname") 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(name = "from_second") public static Expression fromSecond(BigIntLiteral second) { return fromMicroSecond(second.getValue() * 1000 * 1000); } - @ExecFunction(name = "from_millisecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "from_millisecond") public static Expression fromMilliSecond(BigIntLiteral milliSecond) { return fromMicroSecond(milliSecond.getValue() * 1000); } - @ExecFunction(name = "from_microsecond", argTypes = {"BIGINT"}, returnType = "DATETIMEV2") + @ExecFunction(name = "from_microsecond") 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(name = "microseconds_diff") 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(name = "milliseconds_diff") 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(name = "seconds_diff") 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(name = "seconds_diff") 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(name = "seconds_diff") 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(name = "seconds_diff") 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(name = "seconds_diff") 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(name = "minutes_diff") 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(name = "minutes_diff") 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(name = "minutes_diff") 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(name = "minutes_diff") 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(name = "minutes_diff") 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(name = "hours_diff") 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(name = "hours_diff") 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(name = "hours_diff") 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(name = "hours_diff") 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(name = "hours_diff") 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(name = "days_diff") 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(name = "days_diff") 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(name = "days_diff") 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(name = "days_diff") 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(name = "days_diff") 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(name = "weeks_diff") 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(name = "weeks_diff") 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(name = "weeks_diff") 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(name = "weeks_diff") 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(name = "weeks_diff") 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(name = "months_diff") 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(name = "months_diff") 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(name = "months_diff") 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(name = "months_diff") 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(name = "months_diff") 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(name = "years_diff") 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(name = "years_diff") 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(name = "years_diff") 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(name = "years_diff") 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(name = "years_diff") 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..a86e933c9ffe93 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(name = "abs") public static Expression abs(TinyIntLiteral literal) { return new SmallIntLiteral((short) Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"SMALLINT"}, returnType = "INT") + @ExecFunction(name = "abs") public static Expression abs(SmallIntLiteral literal) { return new IntegerLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"INT"}, returnType = "BIGINT") + @ExecFunction(name = "abs") public static Expression abs(IntegerLiteral literal) { return new BigIntLiteral(Math.abs((long) literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"BIGINT"}, returnType = "LARGEINT") + @ExecFunction(name = "abs") public static Expression abs(BigIntLiteral literal) { return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); } - @ExecFunction(name = "abs", argTypes = {"LARGEINT"}, returnType = "LARGEINT") + @ExecFunction(name = "abs") public static Expression abs(LargeIntLiteral literal) { return new LargeIntLiteral(literal.getValue().abs()); } - @ExecFunction(name = "abs", argTypes = {"FLOAT"}, returnType = "FLOAT") + @ExecFunction(name = "abs") public static Expression abs(FloatLiteral literal) { return new FloatLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"DOUBLE"}, returnType = "DOUBLE") + @ExecFunction(name = "abs") public static Expression abs(DoubleLiteral literal) { return new DoubleLiteral(Math.abs(literal.getValue())); } - @ExecFunction(name = "abs", argTypes = {"DECIMALV2"}, returnType = "DECIMALV2") + @ExecFunction(name = "abs") public static Expression abs(DecimalLiteral literal) { return new DecimalLiteral(literal.getValue().abs()); } - @ExecFunction(name = "abs", argTypes = {"DECIMALV3"}, returnType = "DECIMALV3") + @ExecFunction(name = "abs") 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(name = "acos") 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(name = "append_trailing_char_if_absent") 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(name = "e") public static Expression e() { // CHECKSTYLE IGNORE THIS LINE return new DoubleLiteral(Math.E); } - @ExecFunction(name = "p1", argTypes = {}, returnType = "DOUBLE") + @ExecFunction(name = "p1") 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..ba0b75e75dd77e 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "add") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "subtract") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "multiply") 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(name = "divide") 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(name = "divide") 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(name = "divide") 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 6f2ff11ad9a139..bc9cc29e7d06a0 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 @@ -67,7 +67,7 @@ private static Expression castStringLikeLiteral(StringLikeLiteral first, String /** * Executable arithmetic functions concat */ - @ExecFunction(name = "concat", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "concat") public static Expression concatVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { String result = first.getValue() + second.getValue(); return castStringLikeLiteral(first, result); @@ -102,7 +102,7 @@ private static String substringImpl(String first, int second, int third) { /** * Executable arithmetic functions substring */ - @ExecFunction(name = "substring", argTypes = {"VARCHAR", "INT", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "substring") public static Expression substringVarcharIntInt(StringLikeLiteral first, IntegerLiteral second, IntegerLiteral third) { return castStringLikeLiteral(first, substringImpl(first.getValue(), second.getValue(), third.getValue())); @@ -111,7 +111,7 @@ public static Expression substringVarcharIntInt(StringLikeLiteral first, /** * Executable arithmetic functions length */ - @ExecFunction(name = "length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "length") public static Expression lengthVarchar(StringLikeLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -119,7 +119,7 @@ public static Expression lengthVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions Lower */ - @ExecFunction(name = "lower", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "lower") public static Expression lowerVarchar(StringLikeLiteral first) { return castStringLikeLiteral(first, first.getValue().toLowerCase()); } @@ -127,7 +127,7 @@ public static Expression lowerVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions Upper */ - @ExecFunction(name = "upper", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "upper") public static Expression upperVarchar(StringLikeLiteral first) { return castStringLikeLiteral(first, first.getValue().toUpperCase()); } @@ -153,7 +153,7 @@ private static String trimImpl(String first, String second, boolean left, boolea /** * Executable arithmetic functions Trim */ - @ExecFunction(name = "trim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "trim") public static Expression trimVarchar(StringLikeLiteral first) { return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", true, true)); } @@ -161,7 +161,7 @@ public static Expression trimVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions Trim */ - @ExecFunction(name = "trim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "trim") public static Expression trimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), true, true)); } @@ -169,7 +169,7 @@ public static Expression trimVarcharVarchar(StringLikeLiteral first, StringLikeL /** * Executable arithmetic functions ltrim */ - @ExecFunction(name = "ltrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "ltrim") public static Expression ltrimVarchar(StringLikeLiteral first) { return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", true, false)); } @@ -177,7 +177,7 @@ public static Expression ltrimVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions ltrim */ - @ExecFunction(name = "ltrim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "ltrim") public static Expression ltrimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), true, false)); } @@ -185,7 +185,7 @@ public static Expression ltrimVarcharVarchar(StringLikeLiteral first, StringLike /** * Executable arithmetic functions rtrim */ - @ExecFunction(name = "rtrim", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "rtrim") public static Expression rtrimVarchar(StringLikeLiteral first) { return castStringLikeLiteral(first, trimImpl(first.getValue(), " ", false, true)); } @@ -193,7 +193,7 @@ public static Expression rtrimVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions rtrim */ - @ExecFunction(name = "rtrim", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "rtrim") public static Expression rtrimVarcharVarchar(StringLikeLiteral first, StringLikeLiteral second) { return castStringLikeLiteral(first, trimImpl(first.getValue(), second.getValue(), false, true)); } @@ -201,7 +201,7 @@ public static Expression rtrimVarcharVarchar(StringLikeLiteral first, StringLike /** * Executable arithmetic functions Replace */ - @ExecFunction(name = "replace", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "replace") public static Expression replace(StringLikeLiteral first, StringLikeLiteral second, StringLikeLiteral third) { if (second.getValue().length() == 0) { return castStringLikeLiteral(first, first.getValue()); @@ -212,7 +212,7 @@ public static Expression replace(StringLikeLiteral first, StringLikeLiteral seco /** * Executable arithmetic functions Left */ - @ExecFunction(name = "left", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "left") public static Expression left(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return castStringLikeLiteral(first, ""); @@ -226,7 +226,7 @@ public static Expression left(StringLikeLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Right */ - @ExecFunction(name = "right", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "right") public static Expression right(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return castStringLikeLiteral(first, ""); @@ -246,7 +246,7 @@ public static Expression right(StringLikeLiteral first, IntegerLiteral second) { /** * Executable arithmetic functions Locate */ - @ExecFunction(name = "locate", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "locate") public static Expression locate(StringLikeLiteral first, StringLikeLiteral second) { return new IntegerLiteral(second.getValue().trim().indexOf(first.getValue()) + 1); } @@ -254,7 +254,7 @@ public static Expression locate(StringLikeLiteral first, StringLikeLiteral secon /** * Executable arithmetic functions Instr */ - @ExecFunction(name = "instr", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "instr") public static Expression instr(StringLikeLiteral first, StringLikeLiteral second) { return new IntegerLiteral(first.getValue().indexOf(second.getValue()) + 1); } @@ -262,7 +262,7 @@ public static Expression instr(StringLikeLiteral first, StringLikeLiteral second /** * Executable arithmetic functions Ascii */ - @ExecFunction(name = "ascii", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "ascii") public static Expression ascii(StringLikeLiteral first) { if (first.getValue().length() == 0) { return new IntegerLiteral(0); @@ -274,7 +274,7 @@ public static Expression ascii(StringLikeLiteral first) { /** * Executable arithmetic functions Bin */ - @ExecFunction(name = "bin", argTypes = {"BIGINT"}, returnType = "VARCHAR") + @ExecFunction(name = "bin") public static Expression bin(BigIntLiteral first) { return new VarcharLiteral(Long.toBinaryString(first.getValue())); } @@ -282,7 +282,7 @@ public static Expression bin(BigIntLiteral first) { /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(name = "concat_ws", argTypes = {"VARCHAR", "ARRAY"}, returnType = "VARCHAR") + @ExecFunction(name = "concat_ws") public static Expression concatWsVarcharArray(StringLikeLiteral first, ArrayLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue().size() - 1; i++) { @@ -298,7 +298,7 @@ public static Expression concatWsVarcharArray(StringLikeLiteral first, ArrayLite /** * Executable arithmetic functions ConcatWs */ - @ExecFunction(varArgs = true, name = "concat_ws", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "concat_ws") public static Expression concatWsVarcharVarchar(StringLikeLiteral first, VarcharLiteral... second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.length - 1; i++) { @@ -312,7 +312,7 @@ public static Expression concatWsVarcharVarchar(StringLikeLiteral first, Varchar /** * Executable arithmetic functions CharacterLength */ - @ExecFunction(name = "character_length", argTypes = {"VARCHAR"}, returnType = "INT") + @ExecFunction(name = "character_length") public static Expression characterLength(StringLikeLiteral first) { return new IntegerLiteral(first.getValue().length()); } @@ -328,7 +328,7 @@ private static boolean isSeparator(char c) { /** * Executable arithmetic functions initCap */ - @ExecFunction(name = "initcap", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "initcap") public static Expression initCap(StringLikeLiteral first) { StringBuilder result = new StringBuilder(first.getValue().length()); boolean capitalizeNext = true; @@ -350,7 +350,7 @@ public static Expression initCap(StringLikeLiteral first) { /** * Executable arithmetic functions md5 */ - @ExecFunction(name = "md5", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "md5") public static Expression md5(StringLikeLiteral first) { try { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -365,7 +365,7 @@ public static Expression md5(StringLikeLiteral first) { /** * Executable arithmetic functions md5 */ - @ExecFunction(varArgs = true, name = "md5sum", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "md5sum") public static Expression md5Sum(VarcharLiteral... first) { try { // Step 1: Create a MessageDigest instance for MD5 @@ -419,7 +419,7 @@ private static int compareLiteral(Literal first, Literal... second) { /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"INT", "INT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldInt(IntegerLiteral first, IntegerLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -427,7 +427,7 @@ public static Expression fieldInt(IntegerLiteral first, IntegerLiteral... second /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"TINYINT", "TINYINT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldTinyInt(TinyIntLiteral first, TinyIntLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -435,7 +435,7 @@ public static Expression fieldTinyInt(TinyIntLiteral first, TinyIntLiteral... se /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"SMALLINT", "SMALLINT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldSmallInt(SmallIntLiteral first, SmallIntLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -443,7 +443,7 @@ public static Expression fieldSmallInt(SmallIntLiteral first, SmallIntLiteral... /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"BIGINT", "BIGINT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldBigInt(BigIntLiteral first, BigIntLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -451,7 +451,7 @@ public static Expression fieldBigInt(BigIntLiteral first, BigIntLiteral... secon /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"LARGEINT", "LARGEINT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldLargeInt(LargeIntLiteral first, LargeIntLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -459,7 +459,7 @@ public static Expression fieldLargeInt(LargeIntLiteral first, LargeIntLiteral... /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"FLOAT", "FLOAT"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldFloat(FloatLiteral first, FloatLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -467,7 +467,7 @@ public static Expression fieldFloat(FloatLiteral first, FloatLiteral... second) /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"DOUBLE", "DOUBLE"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldDouble(DoubleLiteral first, DoubleLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -475,7 +475,7 @@ public static Expression fieldDouble(DoubleLiteral first, DoubleLiteral... secon /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"DECIMAL", "DECIMAL"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldDecimalV2(DecimalLiteral first, DecimalLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -483,7 +483,7 @@ public static Expression fieldDecimalV2(DecimalLiteral first, DecimalLiteral... /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"DECIMALV3", "DECIMALV3"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldDecimalV3(DecimalV3Literal first, DecimalV3Literal... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -491,7 +491,7 @@ public static Expression fieldDecimalV3(DecimalV3Literal first, DecimalV3Literal /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"DATETIME", "DATETIME"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldDateTime(DateTimeLiteral first, DateTimeLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -499,7 +499,7 @@ public static Expression fieldDateTime(DateTimeLiteral first, DateTimeLiteral... /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"DATETIMEV2", "DATETIMEV2"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldDateTimeV2(DateTimeV2Literal first, DateTimeV2Literal... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -507,7 +507,7 @@ public static Expression fieldDateTimeV2(DateTimeV2Literal first, DateTimeV2Lite /** * Executable arithmetic functions field */ - @ExecFunction(varArgs = true, name = "field", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "INT") + @ExecFunction(name = "field") public static Expression fieldVarchar(StringLikeLiteral first, VarcharLiteral... second) { return new IntegerLiteral(compareLiteral(first, second)); } @@ -525,7 +525,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") + @ExecFunction(name = "find_in_set") public static Expression findInSetVarchar(StringLikeLiteral first, StringLikeLiteral second) { return new IntegerLiteral(findStringInSet(first.getValue(), second.getValue())); } @@ -533,7 +533,7 @@ public static Expression findInSetVarchar(StringLikeLiteral first, StringLikeLit /** * Executable arithmetic functions repeat */ - @ExecFunction(name = "repeat", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "repeat") public static Expression repeat(StringLikeLiteral first, IntegerLiteral second) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < second.getValue(); i++) { @@ -545,7 +545,7 @@ public static Expression repeat(StringLikeLiteral first, IntegerLiteral second) /** * Executable arithmetic functions reverse */ - @ExecFunction(name = "reverse", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "reverse") public static Expression reverseVarchar(StringLikeLiteral first) { StringBuilder sb = new StringBuilder(); sb.append(first.getValue()); @@ -555,7 +555,7 @@ public static Expression reverseVarchar(StringLikeLiteral first) { /** * Executable arithmetic functions space */ - @ExecFunction(name = "space", argTypes = {"INT"}, returnType = "VARCHAR") + @ExecFunction(name = "space") public static Expression space(IntegerLiteral first) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < first.getValue(); i++) { @@ -567,7 +567,7 @@ public static Expression space(IntegerLiteral first) { /** * Executable arithmetic functions split_by_char */ - @ExecFunction(name = "split_by_char", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "ARRAY") + @ExecFunction(name = "split_by_char") public static Expression splitByChar(StringLikeLiteral first, StringLikeLiteral second) { String[] result = first.getValue().split(second.getValue()); List items = new ArrayList<>(); @@ -580,7 +580,7 @@ public static Expression splitByChar(StringLikeLiteral first, StringLikeLiteral /** * Executable arithmetic functions split_part */ - @ExecFunction(name = "split_part", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "split_part") 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) { @@ -623,7 +623,7 @@ public static Expression splitPart(StringLikeLiteral first, StringLikeLiteral ch /** * Executable arithmetic functions substring_index */ - @ExecFunction(name = "substring_index", argTypes = {"VARCHAR", "VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "substring_index") public static Expression substringIndex(StringLikeLiteral first, StringLikeLiteral chr, IntegerLiteral number) { String[] parts = first.getValue().split(chr.getValue()); if (Math.abs(number.getValue()) >= parts.length) { @@ -652,7 +652,7 @@ public static Expression substringIndex(StringLikeLiteral first, StringLikeLiter /** * Executable arithmetic functions strcmp */ - @ExecFunction(name = "strcmp", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "TINYINT") + @ExecFunction(name = "strcmp") public static Expression strcmp(StringLikeLiteral first, StringLikeLiteral second) { int result = first.getValue().compareTo(second.getValue()); if (result == 0) { @@ -667,7 +667,7 @@ public static Expression strcmp(StringLikeLiteral first, StringLikeLiteral secon /** * Executable arithmetic functions strLeft */ - @ExecFunction(name = "strleft", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "strleft") public static Expression strLeft(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() <= 0) { return castStringLikeLiteral(first, ""); @@ -681,7 +681,7 @@ public static Expression strLeft(StringLikeLiteral first, IntegerLiteral second) /** * Executable arithmetic functions strRight */ - @ExecFunction(name = "strright", argTypes = {"VARCHAR", "INT"}, returnType = "VARCHAR") + @ExecFunction(name = "strright") public static Expression strRight(StringLikeLiteral first, IntegerLiteral second) { if (second.getValue() < (- first.getValue().length()) || Math.abs(second.getValue()) == 0) { return castStringLikeLiteral(first, ""); @@ -701,7 +701,7 @@ public static Expression strRight(StringLikeLiteral first, IntegerLiteral second /** * Executable arithmetic functions overlay */ - @ExecFunction(name = "overlay", argTypes = {"VARCHAR", "INT", "INT", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "overlay") public static Expression overlay(StringLikeLiteral first, IntegerLiteral second, IntegerLiteral third, StringLikeLiteral four) { StringBuilder sb = new StringBuilder(); @@ -725,7 +725,7 @@ public static Expression overlay(StringLikeLiteral first, /** * Executable arithmetic functions parseurl */ - @ExecFunction(name = "parse_url", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "parse_url") public static Expression parseurl(StringLikeLiteral first, StringLikeLiteral second) { URI uri = null; try { @@ -780,7 +780,7 @@ public static Expression parseurl(StringLikeLiteral first, StringLikeLiteral sec /** * Executable arithmetic functions urldecode */ - @ExecFunction(name = "url_decode", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "url_decode") public static Expression urlDecode(StringLikeLiteral first) { try { return castStringLikeLiteral(first, URLDecoder.decode(first.getValue(), StandardCharsets.UTF_8.name())); @@ -792,7 +792,7 @@ public static Expression urlDecode(StringLikeLiteral first) { /** * Executable arithmetic functions append_trailing_char_if_absent */ - @ExecFunction(name = "append_trailing_char_if_absent", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "append_trailing_char_if_absent") public static Expression appendTrailingCharIfAbsent(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue().endsWith(second.getValue())) { return first; @@ -804,7 +804,7 @@ public static Expression appendTrailingCharIfAbsent(StringLikeLiteral first, Str /** * Executable arithmetic functions endsWith */ - @ExecFunction(name = "ends_with", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "BOOLEAN") + @ExecFunction(name = "ends_with") public static Expression endsWith(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue().endsWith(second.getValue())) { return BooleanLiteral.TRUE; @@ -816,7 +816,7 @@ public static Expression endsWith(StringLikeLiteral first, StringLikeLiteral sec /** * Executable arithmetic functions extractUrlParameter */ - @ExecFunction(name = "extract_url_parameter", argTypes = {"VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "extract_url_parameter") public static Expression extractUrlParameter(StringLikeLiteral first, StringLikeLiteral second) { if (first.getValue() == null || first.getValue().indexOf('?') == -1) { return castStringLikeLiteral(first, ""); @@ -840,7 +840,7 @@ public static Expression extractUrlParameter(StringLikeLiteral first, StringLike /** * Executable arithmetic functions quote */ - @ExecFunction(name = "quote", argTypes = {"VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "quote") public static Expression quote(StringLikeLiteral first) { return castStringLikeLiteral(first, "\'" + first.getValue() + "\'"); } @@ -848,7 +848,7 @@ public static Expression quote(StringLikeLiteral first) { /** * Executable arithmetic functions replaceEmpty */ - @ExecFunction(name = "replace_empty", argTypes = {"VARCHAR", "VARCHAR", "VARCHAR"}, returnType = "VARCHAR") + @ExecFunction(name = "replace_empty") 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/executable/TimeRoundSeries.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/TimeRoundSeries.java index 3a98ee6252791a..41254428322b67 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "year_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "month_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "day_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "hour_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "minute_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "second_ceil") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "year_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "month_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "day_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "hour_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "minute_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") 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(name = "second_floor") public static Expression secondFloor(DateTimeV2Literal date, IntegerLiteral period, DateTimeV2Literal origin) { return DateTimeV2Literal.fromJavaDateType(getDateCeilOrFloor(DATE.SECOND, date.toJavaDateType(),