presto-jdbc/src/main/java/io/prestosql/jdbc/ObjectCasts.java/ObjectCasts/castToShort
class ObjectCasts:    public static short castToShort(Object x, int targetSqlType)
            throws SQLException
    {
        if (x instanceof Boolean) {
            return (short) (((Boolean) x) ? 1 : 0);
        }
        try {
            if (x instanceof Number) {
                return ((Number) x).shortValue();
            }
            if (x instanceof String) {
                return parseShort((String) x);
            }
        }
        catch (RuntimeException e) {
            throw invalidConversion(x, targetSqlType, e);
        }
        throw invalidConversion(x, targetSqlType);
    }