@ScalarOperator(CAST)
    @SqlType(StandardTypes.TINYINT)
    public static long castToTinyint(@SqlType(StandardTypes.INTEGER) long value)
    {
        try {
            return SignedBytes.checkedCast(value);
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, "Out of range for tinyint: " + value, e);
        }
    }
@Test
    public void testCastToTinyint()
    {
        assertFunction("cast(INTEGER'37' as tinyint)", TINYINT, (byte) 37);
        assertFunction("cast(INTEGER'17' as tinyint)", TINYINT, (byte) 17);
    }