[feature](function)Add ST_Angle_Sphere function (#17919)

This commit is contained in:
Liqf
2023-03-27 10:14:46 +08:00
committed by GitHub
parent fd5dd9a391
commit bcf95cd920
17 changed files with 328 additions and 29 deletions

View File

@ -263,6 +263,7 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitByChar;
import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitByString;
import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitPart;
import org.apache.doris.nereids.trees.expressions.functions.scalar.Sqrt;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAngleSphere;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAstext;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAswkt;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StCircle;
@ -586,6 +587,7 @@ public class BuiltinScalarFunctions implements FunctionHelper {
scalar(StCircle.class, "st_circle"),
scalar(StContains.class, "st_contains"),
scalar(StDistanceSphere.class, "st_distance_sphere"),
scalar(StAngleSphere.class, "st_angle_sphere"),
scalar(StGeometryfromtext.class, "st_geometryfromtext"),
scalar(StGeomfromtext.class, "st_geomfromtext"),
scalar(StLinefromtext.class, "st_linefromtext"),

View File

@ -0,0 +1,66 @@
// 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.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.DoubleType;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;
/**
* ScalarFunction 'st_Angle_sphere'. This class is generated by GenerateFunction.
*/
public class StAngleSphere extends ScalarFunction
implements ExplicitlyCastableSignature, AlwaysNullable {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(DoubleType.INSTANCE)
.args(DoubleType.INSTANCE, DoubleType.INSTANCE, DoubleType.INSTANCE, DoubleType.INSTANCE)
);
/**
* constructor with 4 arguments.
*/
public StAngleSphere(Expression arg0, Expression arg1, Expression arg2, Expression arg3) {
super("st_angle_sphere", arg0, arg1, arg2, arg3);
}
@Override
public Expression withChildren(List<Expression> children) {
Preconditions.checkArgument(children.size() == 4);
return new StAngleSphere(children.get(0), children.get(1), children.get(2), children.get(3));
}
@Override
public List<FunctionSignature> getSignatures() {
return SIGNATURES;
}
@Override
public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
return visitor.visitStAngleSphere(this, context);
}
}

View File

@ -265,6 +265,7 @@ import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitByChar;
import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitByString;
import org.apache.doris.nereids.trees.expressions.functions.scalar.SplitPart;
import org.apache.doris.nereids.trees.expressions.functions.scalar.Sqrt;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAngleSphere;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAstext;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StAswkt;
import org.apache.doris.nereids.trees.expressions.functions.scalar.StCircle;
@ -1346,6 +1347,10 @@ public interface ScalarFunctionVisitor<R, C> {
return visitScalarFunction(stDistanceSphere, context);
}
default R visitStAngleSphere(StAngleSphere stAngleSphere, C context) {
return visitScalarFunction(stAngleSphere, context);
}
default R visitStGeometryfromtext(StGeometryfromtext stGeometryfromtext, C context) {
return visitScalarFunction(stGeometryfromtext, context);
}