You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/06/20 03:48:00 UTC

[jira] [Updated] (HUDI-4285) ByteBuffer forget to rewind after get in AvroDeserializer

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

ASF GitHub Bot updated HUDI-4285:
---------------------------------
    Labels: pull-request-available  (was: )

> ByteBuffer forget to rewind after get in AvroDeserializer
> ---------------------------------------------------------
>
>                 Key: HUDI-4285
>                 URL: https://issues.apache.org/jira/browse/HUDI-4285
>             Project: Apache Hudi
>          Issue Type: Bug
>            Reporter: Frank Wong
>            Priority: Major
>              Labels: pull-request-available
>
> {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)