Commit ee7a17c
### What changes were proposed in this pull request?
Fixed `SparkConnectResultSet.getString()` to properly convert BINARY data to UTF-8 strings instead of returning byte array object references (e.g., "[B<hashcode>").
### Why are the changes needed?
The current implementation violates JDBC specification behavior. Users calling getString() on BINARY columns expect UTF-8 decoded strings, not Java object references.
Before
```
SELECT binary('xDeAdBeEf')
spark-sql: `\xDeAdBeEf`
beeline with STS: `\xDeAdBeEf`
beeline with Connect Server: `[B4d518c66`
```
After
```
SELECT binary('xDeAdBeEf')
spark-sql: `\xDeAdBeEf`
beeline with STS: `\xDeAdBeEf`
beeline with Connect Server: `\xDeAdBeEf`
```
### Does this PR introduce _any_ user-facing change?
Yes. getString() on BINARY columns now returns UTF-8 decoded strings instead of byte array references like "[B1a2b3c4d".
### How was this patch tested?
Added new test
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #53262 from vinodkc/br_fix_getString_BINARY.
Authored-by: vinodkc <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit f5b9ea8)
Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent b572b7c commit ee7a17c
File tree
2 files changed
+31
-1
lines changed- sql/connect/client/jdbc/src
- main/scala/org/apache/spark/sql/connect/client/jdbc
- test/scala/org/apache/spark/sql/connect/client/jdbc
2 files changed
+31
-1
lines changedLines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
| |||
396 | 401 | | |
397 | 402 | | |
398 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
399 | 420 | | |
400 | 421 | | |
401 | 422 | | |
| |||
437 | 458 | | |
438 | 459 | | |
439 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
440 | 464 | | |
441 | 465 | | |
442 | 466 | | |
| |||
0 commit comments