@SqlNullable
    @Description("Returns whether the first string ends with the second")
    @ScalarFunction("ends_with")
    @LiteralParameters({"x", "y"})
    @SqlType(StandardTypes.BOOLEAN)
    public static Boolean endsWith(@SqlType("varchar(x)") Slice x, @SqlType("varchar(y)") Slice y)
    {
        if (x.length() < y.length()) {
            return false;
        }

        return x.equals(x.length() - y.length(), y.length(), y, 0, y.length());
    }
@Test
    public void testEndsWith()
    {
        assertFunction("ends_with('abcd', 'cd')", BOOLEAN, true);
        assertFunction("ends_with('abcd', '')", BOOLEAN, true);
        assertFunction("ends_with('abcd', 'zs')", BOOLEAN, false);
        assertFunction("ends_with('', 'zs')", BOOLEAN, false);
        assertFunction("ends_with(NULL, 'ba')", BOOLEAN, null);
        assertFunction("ends_with('abcd', NULL)", BOOLEAN, null);
        assertFunction("ends_with('', NULL)", BOOLEAN, null);
        assertFunction("ends_with(NULL, '')", BOOLEAN, null);
        assertFunction("ends_with(NULL, NULL)", BOOLEAN, null);
    }