You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2022/06/27 02:08:00 UTC
[jira] [Resolved] (SPARK-39575) ByteBuffer forget to rewind after get in AvroDeserializer
[ https://issues.apache.org/jira/browse/SPARK-39575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean R. Owen resolved SPARK-39575.
----------------------------------
Fix Version/s: 3.4.0
3.3.1
3.2.2
Resolution: Fixed
Issue resolved by pull request 36973
[https://github.com/apache/spark/pull/36973]
> ByteBuffer forget to rewind after get in AvroDeserializer
> ---------------------------------------------------------
>
> Key: SPARK-39575
> URL: https://issues.apache.org/jira/browse/SPARK-39575
> Project: Spark
> Issue Type: Bug
> Components: Spark Core
> Affects Versions: 3.3.0
> Reporter: Frank Wong
> Assignee: Frank Wong
> Priority: Major
> Fix For: 3.3.1, 3.2.2, 3.4.0
>
>
> {code:java}
> case (BYTES, BinaryType) => (updater, ordinal, value) =>
> val bytes = value match {
> case b: ByteBuffer =>
> val bytes = new Array[Byte](b.remaining)
> b.get(bytes)
> // Do not forget to reset the position
> b.rewind()
> bytes
> case b: Array[Byte] => b
> case other => throw new RuntimeException(s"$other is not a valid avro binary.")
> }
> updater.set(ordinal, bytes) {code}
> After Avro data is converted to InternalRow, there will be redundant position in ByteBuffer type caused by ByteBuffer#get
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org