presto-jdbc/src/main/java/io/prestosql/jdbc/ObjectCasts.java/ObjectCasts/castToBinary
class ObjectCasts:    public static byte[] castToBinary(Object x, int targetSqlType)
            throws SQLException
    {
        if (x instanceof byte[]) {
            return (byte[]) x;
        }
        if (x instanceof String) {
            return ((String) x).getBytes(UTF_8);
        }
        throw invalidConversion(x, targetSqlType);
    }