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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to