presto-teradata-functions/src/main/java/io/prestosql/teradata/functions/TeradataStringFunctions.java/TeradataStringFunctions/substring
class TeradataStringFunctions:    @Description("substring of given length starting at an index")
    @ScalarFunction
    @LiteralParameters("x")
    @SqlType("varchar(x)")
    public static Slice substring(
            @FunctionDependency(
                    name = "substr",
                    argumentTypes = {"varchar(x)", StandardTypes.BIGINT, StandardTypes.BIGINT})
                    MethodHandle method,
            @SqlType("varchar(x)") Slice utf8,
            @SqlType(StandardTypes.BIGINT) long start,
            @SqlType(StandardTypes.BIGINT) long length)
    {
        try {
            return (Slice) method.invokeExact(utf8, start, length);
        }
        catch (Throwable t) {
            throwIfInstanceOf(t, Error.class);
            throwIfInstanceOf(t, PrestoException.class);
            throw new PrestoException(GENERIC_INTERNAL_ERROR, t);
        }
    }