You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/15 17:33:23 UTC

[GitHub] [spark] Ciampi10 commented on a change in pull request #31809: Fix avro decoding based on avro MAGIC_NUMBER presence

Ciampi10 commented on a change in pull request #31809:
URL: https://github.com/apache/spark/pull/31809#discussion_r593220320



##########
File path: external/avro/src/main/scala/org/apache/spark/sql/avro/AvroDataToCatalyst.scala
##########
@@ -91,11 +91,35 @@ private[avro] case class AvroDataToCatalyst(
         null
     }
 
+  /**
+   * This computes the offset for avro binary decoding based on the presence of a magic number
+   * defined in avro BinaryMessageEncoder.java as of now we are assuming that the binary
+   * provided was encoded via avro BinaryEncoder.java. However some serializers use
+   * the former strategy instead which prepend the binary with a magic number followed
+   * by a 8-byte schema fingerprint. This method detects the presence
+   * of the magic number and if thats the case the offset returned skips the magic
+   * plus fingerprint bytes.
+   */
+  private def getBinaryOffset(binary: Array[Byte]): Int = {

Review comment:
       @Kinglet




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org