Skip to content

Commit

Permalink
Merge pull request #4 from manics/batch_load_offset_fix
Browse files Browse the repository at this point in the history
Fix table batch read offsets
  • Loading branch information
antalbalint committed Dec 13, 2015
2 parents 1724d68 + 4913b08 commit 82c5b99
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ protected void readTable(OriginalFile file) throws ServerError {

//read headers
Column[] cols = table.getHeaders();
int tableLength = (int) table.getNumberOfRows();
table.close();

Mineotaur.LOGGER.info(Arrays.toString(cols));
List<Integer> experimentIDs = new ArrayList<>();
List<Integer> strainIDs = new ArrayList<>();
Expand Down Expand Up @@ -381,11 +384,9 @@ else if ("reference".equals(colName) || "name".equals(colName) || "alternativeNa
columnsToRead[i] = i;
}

// The number of columns we wish to read.
int tableLength = (int) table.getNumberOfRows() - 1;
for (int currentBatch = 0; currentBatch < tableLength; currentBatch += rowsToFetch) {

int batchSize = Math.min(currentBatch + rowsToFetch, tableLength);
int batchSize = Math.min(rowsToFetch, tableLength - currentBatch);
long[] rowSubset = new long[(int) (batchSize)];
for (int j = 0; j < rowSubset.length; j++) {
rowSubset[j] = j + currentBatch;
Expand Down

0 comments on commit 82c5b99

Please sign in to comment.