morrySnow commented on code in PR #30823: URL: https://github.com/apache/doris/pull/30823#discussion_r1498905900
########## regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions.groovy: ########## @@ -335,4 +335,86 @@ suite("test_array_functions") { qt_sql """ select array_position(kadcml, kdcmls1), kadcml, kdcmls1 from fn_test;""" + /* + test scope: + 1.array_range function with datetimev2 type + 2.sequence function(alias of array_range) with int and datetimev2 type Review Comment: add regression cases under `regression-test/suites/nereids_function_p0/scalar_function/Array.groovy` ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayRangeYearUnit.java: ########## @@ -0,0 +1,72 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.expressions.functions.scalar; + +import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable; +import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; +import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression; +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; +import org.apache.doris.nereids.types.ArrayType; +import org.apache.doris.nereids.types.DateTimeV2Type; +import org.apache.doris.nereids.types.IntegerType; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** + * ScalarFunction 'array_range_year_unit'. + */ +public class ArrayRangeYearUnit extends ScalarFunction + implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { + private static final List<FunctionSignature> SIGNATURES = ImmutableList.of( + FunctionSignature.ret(ArrayType.of(DateTimeV2Type.SYSTEM_DEFAULT)) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(ArrayType.of(DateTimeV2Type.SYSTEM_DEFAULT)) + .args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT, IntegerType.INSTANCE) + ); + + /** + * constructor with 3 arguments. + */ + public ArrayRangeYearUnit(Expression arg0, Expression arg1, Expression arg2) { Review Comment: if u have both 2 args and 3 args signatures, u should add ctors with 2 args and 3 args. Or if u always use 3 args signature when bind function, u should remove the signature with 2 args -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org