|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +package org.apache.doris.nereids.trees.expressions.functions.scalar; |
| 19 | + |
| 20 | +import org.apache.doris.catalog.FunctionSignature; |
| 21 | +import org.apache.doris.nereids.trees.expressions.Expression; |
| 22 | +import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; |
| 23 | +import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable; |
| 24 | +import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; |
| 25 | +import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; |
| 26 | +import org.apache.doris.nereids.types.BigIntType; |
| 27 | +import org.apache.doris.nereids.types.StringType; |
| 28 | +import org.apache.doris.nereids.types.VarcharType; |
| 29 | + |
| 30 | +import com.google.common.base.Preconditions; |
| 31 | +import com.google.common.collect.ImmutableList; |
| 32 | + |
| 33 | +import java.util.List; |
| 34 | + |
| 35 | +/** |
| 36 | + * ScalarFunction 'crc32'. This class is generated by GenerateFunction. |
| 37 | + */ |
| 38 | +public class Crc32 extends ScalarFunction |
| 39 | + implements UnaryExpression, ExplicitlyCastableSignature, PropagateNullable { |
| 40 | + |
| 41 | + public static final List<FunctionSignature> SIGNATURES = ImmutableList.of( |
| 42 | + FunctionSignature.ret(BigIntType.INSTANCE).args(VarcharType.SYSTEM_DEFAULT), |
| 43 | + FunctionSignature.ret(BigIntType.INSTANCE).args(StringType.INSTANCE) |
| 44 | + ); |
| 45 | + |
| 46 | + /** |
| 47 | + * constructor with 1 argument. |
| 48 | + */ |
| 49 | + public Crc32(Expression arg) { |
| 50 | + super("crc32", arg); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * withChildren. |
| 55 | + */ |
| 56 | + @Override |
| 57 | + public Crc32 withChildren(List<Expression> children) { |
| 58 | + Preconditions.checkArgument(children.size() == 1); |
| 59 | + return new Crc32(children.get(0)); |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public List<FunctionSignature> getSignatures() { |
| 64 | + return SIGNATURES; |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) { |
| 69 | + return visitor.visitCrc32(this, context); |
| 70 | + } |
| 71 | +} |
0 commit comments