Search in sources :

Example 76 with Description

use of io.prestosql.spi.function.Description in project hetu-core by openlookeng.

the class GeoFunctions method stEndPoint.

@SqlNullable
@Description("Returns the last point of a LINESTRING geometry as a Point")
@ScalarFunction("ST_EndPoint")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice stEndPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input) {
    OGCGeometry geometry = deserialize(input);
    validateType("ST_EndPoint", geometry, EnumSet.of(LINE_STRING));
    if (geometry.isEmpty()) {
        return null;
    }
    MultiPath lines = (MultiPath) geometry.getEsriGeometry();
    SpatialReference reference = geometry.getEsriSpatialReference();
    return serialize(createFromEsriGeometry(lines.getPoint(lines.getPointCount() - 1), reference));
}
Also used : OGCGeometry(com.esri.core.geometry.ogc.OGCGeometry) MultiPath(com.esri.core.geometry.MultiPath) SpatialReference(com.esri.core.geometry.SpatialReference) SqlNullable(io.prestosql.spi.function.SqlNullable) ScalarFunction(io.prestosql.spi.function.ScalarFunction) Description(io.prestosql.spi.function.Description) SqlType(io.prestosql.spi.function.SqlType)

Aggregations

Description (io.prestosql.spi.function.Description)76 ScalarFunction (io.prestosql.spi.function.ScalarFunction)76 SqlType (io.prestosql.spi.function.SqlType)76 OGCGeometry (com.esri.core.geometry.ogc.OGCGeometry)40 SqlNullable (io.prestosql.spi.function.SqlNullable)34 Slice (io.airlift.slice.Slice)18 LiteralParameters (io.prestosql.spi.function.LiteralParameters)15 Point (com.esri.core.geometry.Point)14 OGCPoint (com.esri.core.geometry.ogc.OGCPoint)14 Constraint (io.prestosql.type.Constraint)13 MultiPoint (com.esri.core.geometry.MultiPoint)12 BlockBuilder (io.prestosql.spi.block.BlockBuilder)11 PrestoException (io.prestosql.spi.PrestoException)10 SliceUtf8.lengthOfCodePoint (io.airlift.slice.SliceUtf8.lengthOfCodePoint)7 SliceUtf8.offsetOfCodePoint (io.airlift.slice.SliceUtf8.offsetOfCodePoint)7 GeometryType (io.prestosql.geospatial.GeometryType)6 Envelope (com.esri.core.geometry.Envelope)5 MultiPath (com.esri.core.geometry.MultiPath)5 Matcher (io.airlift.joni.Matcher)5 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)5