[ 
https://issues.apache.org/jira/browse/SPARK-54552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vinod KC updated SPARK-54552:
-----------------------------
    Description: 
The getString() method in _SparkConnectResultSet_ does not properly handle 
BINARY data types. When calling getString() on a column with `BINARY` type, the 
method uses String.valueOf() on the raw byte array, which produces an incorrect 
string representation (e.g., "[B@<hashcode>") instead of converting the bytes 
to a proper UTF-8 string.

eg:
{code:java}
SELECT binary('xDeAdBeEf')

spark-sql: `\xDeAdBeEf`
beeline with STS: `\xDeAdBeEf`
beeline with Connect Server: `[B@4d518c66`{code}

  was:
The `getString()` method in `SparkConnectResultSet` does not properly handle 
`BINARY` data types. When calling getString() on a column with `BINARY` type, 
the method uses String.valueOf() on the raw byte array, which produces an 
incorrect string representation (e.g., "[B@<hashcode>") instead of converting 
the bytes to a proper UTF-8 string.

eg:
 `SELECT binary('\\xDeAdBeEf')` 

spark-sql: `\xDeAdBeEf`
beeline with STS: `\xDeAdBeEf`
beeline with Connect Server: `[B@4d518c66`



> SparkConnectResultSet.getString() fails to decode BINARY data as UTF-8
> ----------------------------------------------------------------------
>
>                 Key: SPARK-54552
>                 URL: https://issues.apache.org/jira/browse/SPARK-54552
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 4.1.0
>            Reporter: Vinod KC
>            Priority: Major
>
> The getString() method in _SparkConnectResultSet_ does not properly handle 
> BINARY data types. When calling getString() on a column with `BINARY` type, 
> the method uses String.valueOf() on the raw byte array, which produces an 
> incorrect string representation (e.g., "[B@<hashcode>") instead of converting 
> the bytes to a proper UTF-8 string.
> eg:
> {code:java}
> SELECT binary('xDeAdBeEf')
> spark-sql: `\xDeAdBeEf`
> beeline with STS: `\xDeAdBeEf`
> beeline with Connect Server: `[B@4d518c66`{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to