sadikovi commented on code in PR #45578:
URL: https://github.com/apache/spark/pull/45578#discussion_r1531179747
##########
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:
That's what I was thinking but I could not find an example that double
hasNext has not fixed. So it seems to be fine. I just could not find a better
way of solving this issue at the moment given the FileReader interface.
--
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]