cloud-fan commented on code in PR #45578:
URL: https://github.com/apache/spark/pull/45578#discussion_r1529914252


##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroUtils.scala:
##########
@@ -197,19 +197,21 @@ private[sql] object AvroUtils extends Logging {
 
     def hasNextRow: Boolean = {
       while (!completed && currentRow.isEmpty) {
-        if (fileReader.pastSync(stopPosition)) {
+        // In the case of empty blocks in an Avro file, `blockRemaining` could 
still read as 0 so
+        // `fileReader.hasNext()` returns false but advances the cursor to the 
next block, so we
+        // need to call `fileReader.hasNext()` again to correctly report if 
the next record
+        // exists.

Review Comment:
   hmmm, what if there are continuous empty blocks? how many times we need to 
call `hasNext`?



-- 
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.

To unsubscribe, e-mail: [email protected]

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