Commit 558b395
[SPARK-39575][AVRO] add ByteBuffer#rewind after ByteBuffer#get in Avr…
…oDeserializer
### What changes were proposed in this pull request?
Add ByteBuffer#rewind after ByteBuffer#get in AvroDeserializer.
### Why are the changes needed?
- HeapBuffer.get(bytes) puts the data from POS to the end into bytes, and sets POS as the end. The next call will return empty bytes.
- The second call of AvroDeserializer will return an InternalRow with empty binary column when avro record has binary column.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Add ut in AvroCatalystDataConversionSuite.
Closes #36973 from wzx140/avro-fix.
Authored-by: wangzixuan.wzxuan <[email protected]>
Signed-off-by: Sean Owen <[email protected]>1 parent 5ad8fbc commit 558b395
2 files changed
Lines changed: 23 additions & 0 deletions
File tree
- connector/avro/src
- main/scala/org/apache/spark/sql/avro
- test/scala/org/apache/spark/sql/avro
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
363 | 384 | | |
0 commit comments