Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/20176
  
    Thanks! Next, I'll fix `showString` though, one question; currently casting 
binary to string is different between 
[Cast](https://github.com/apache/spark/blob/2250cb75b99d257e698fe5418a51d8cddb4d5104/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L205)
 and 
[showString](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala#L254).
 Which one is expected? 
    
    FYI: This casting behaviour is different between mysql and postgresql;
    ```
    postgres=# create table t (a bytea);
    CREATE TABLE
    postgres=# insert into t values('abc');
    INSERT 0 1
    postgres=# SELECT CAST(a AS TEXT) from t;
        a     
    ----------
     \x616263
    
    mysql> create table t(a blob);
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> insert into t values('abc');
    Query OK, 1 row affected (0.00 sec)
    
    mysql> select CAST(a AS char) From t;
    +-----------------+
    | CAST(a AS char) |
    +-----------------+
    | abc             |
    +-----------------+
    1 row in set (0.00 sec)
    ``` 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to