arina-ielchiieva commented on a change in pull request #2024: DRILL-7641
Convert Excel Reader to use Streaming Reader
URL: https://github.com/apache/drill/pull/2024#discussion_r399236600
##########
File path:
contrib/format-excel/src/main/java/org/apache/drill/exec/store/excel/ExcelBatchReader.java
##########
@@ -267,14 +269,21 @@ private XSSFSheet getSheet() {
/**
* Returns the column count. There are a few gotchas here in that we have
to know the header row and count the physical number of cells
- * in that row. Since the user can define the header row,
+ * in that row. This function also has to move the rowIterator object to
the first row of data.
* @return The number of actual columns
*/
private int getColumnCount() {
+ // Initialize
+ currentRow = rowIterator.next();
int rowNumber = readerConfig.headerRow > 0 ? sheet.getFirstRowNum() : 0;
- XSSFRow sheetRow = sheet.getRow(rowNumber);
- return sheetRow != null ? sheetRow.getPhysicalNumberOfCells() : 0;
+ // If the headerRow is greater than zero, advance the iterator to the
first row of data
+ // This is unfortunately necessary since the streaming reader eliminated
the getRow() method.
+ for(int i = 1; i < rowNumber; i++) {
Review comment:
```suggestion
for (int i = 1; i < rowNumber; i++) {
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services