presto-jdbc/src/main/java/io/prestosql/jdbc/PrestoResultSet.java/PrestoResultSet/toNumber
class PrestoResultSet:    private static Number toNumber(Object value)
            throws SQLException
    {
        if (value == null) {
            return 0;
        }
        if (value instanceof Number) {
            return (Number) value;
        }
        if (value instanceof Boolean) {
            return ((Boolean) value) ? 1 : 0;
        }
        throw new SQLException("Value is not a number: " + value.getClass().getCanonicalName());
    }