Open
Description
I'm running into the following exception when attempting to process a file:
java.io.IOException: There are no available bytes in the input stream.
at com.epam.parso.impl.SasFileParser.getBytesFromFile(SasFileParser.java:768)
at com.epam.parso.impl.SasFileParser.readSubheaderSignature(SasFileParser.java:423)
at com.epam.parso.impl.SasFileParser.processPageMetadata(SasFileParser.java:392)
at com.epam.parso.impl.SasFileParser.processNextPage(SasFileParser.java:591)
at com.epam.parso.impl.SasFileParser.readNextPage(SasFileParser.java:561)
at com.epam.parso.impl.SasFileParser.readNext(SasFileParser.java:519)
at com.epam.parso.impl.SasFileReaderImpl.readNext(SasFileReaderImpl.java:168)
... 57 elided
The error occurs after processing approximately 400,000 rows, and the file has several million. My code is below:
import java.io.FileInputStream
import com.epam.parso.impl.SasFileReaderImpl
val sasFileReader = new SasFileReaderImpl(new FileInputStream("test.sas7bdat"))
int numRows = sasFileReader.getSasFileProperties().getRowCount()
int currentRowNum = 0
while (currentRowNum < numRows) {
val currentRow = sasFileReader.readNext()
currentRow.foreach(c => print(c + "|"))
currentRowNum += 1
}
Environment details:
I'm running this on an EMR cluster with Scala 2.11.