sohardforaname commented on code in PR #18257: URL: https://github.com/apache/doris/pull/18257#discussion_r1247387913
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/udf/AliasUdf.java: ########## @@ -0,0 +1,145 @@ +// 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.udf; + +import org.apache.doris.catalog.AliasFunction; +import org.apache.doris.catalog.Env; +import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.analyzer.UnboundFunction; +import org.apache.doris.nereids.analyzer.UnboundSlot; +import org.apache.doris.nereids.parser.NereidsParser; +import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.VirtualSlotReference; +import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; +import org.apache.doris.nereids.trees.expressions.functions.scalar.ScalarFunction; +import org.apache.doris.nereids.trees.expressions.visitor.DefaultExpressionRewriter; +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; +import org.apache.doris.nereids.types.DataType; +import org.apache.doris.nereids.types.NullType; + +import com.google.common.base.Suppliers; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * alias function + */ +public class AliasUdf extends ScalarFunction implements ExplicitlyCastableSignature { + private final UnboundFunction unboundFunction; + private final List<String> parameters; + private final List<DataType> argTypes; + private DataType retType; + + /** + * constructor + */ + public AliasUdf(String name, List<DataType> argTypes, UnboundFunction unboundFunction, + List<String> parameters, Expression... arguments) { + super(name, arguments); + this.argTypes = argTypes; + this.unboundFunction = unboundFunction; + this.parameters = parameters; + } + + @Override + public List<FunctionSignature> getSignatures() { + return ImmutableList.of(Suppliers.memoize(() -> FunctionSignature + .of(NullType.INSTANCE, argTypes)).get()); + } + + public List<String> getParameters() { + return parameters; + } + + public UnboundFunction getUnboundFunction() { + return unboundFunction; + } + + public List<DataType> getArgTypes() { + return argTypes; + } + + @Override + public boolean nullable() { + return false; + } + + /** + * translate catalog alias function to nereids alias function + */ + public static void translateToNereidsFunction(String dbName, AliasFunction function) { Review Comment: What does it means? -- 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