Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,19 @@ private[sql] object AvroUtils extends Logging {

def hasNextRow: Boolean = {
while (!completed && currentRow.isEmpty) {
val r = fileReader.hasNext && !fileReader.pastSync(stopPosition)
if (!r) {
if (fileReader.pastSync(stopPosition)) {
fileReader.close()
completed = true
currentRow = None
} else {
} else if (fileReader.hasNext()) {
val record = fileReader.next()
// the row must be deserialized in hasNextRow, because AvroDeserializer#deserialize
// potentially filters rows
currentRow = deserializer.deserialize(record).asInstanceOf[Option[InternalRow]]
} else {
// In this case, `fileReader.hasNext()` returns false but we are not past sync point yet.
// This means empty blocks, we need to continue reading the file in case there are non
// empty blocks or we are past sync point.
}
}
currentRow.isDefined
Expand Down
Loading