We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the case where if (currentBlock.get() < blocksize) is false, the CSVRecord e is lost. You'll notice this as a missing row for each block.
My solution was to remove the conditional logic for processing e, and add the conditional logic only in the part where the block is processed.
Here is my updated code: ` try (CSVParser parser = new CSVParser(fbr, sortOptions.getFormat())) { parser.spliterator().forEachRemaining(e -> { if (e.getRecordNumber() <= sortOptions.getNumHeader()) { header[0] = e; } else { tmplist.add(e); currentBlock.addAndGet(SizeEstimator.estimatedSizeOf(e)); } if (currentBlock.get() >= blocksize) { try { files.add(sortAndSave(tmplist, tmpdirectory, sortOptions, header[0])); } catch (IOException e1) { logger.warn(String.format("Error during the sort in batch"),e1); //$NON-NLS-1$ } tmplist.clear(); currentBlock.getAndSet(0); }
}); }
`
The text was updated successfully, but these errors were encountered:
CsvExternalSort.java.txt
Sorry, something went wrong.
I agree that it is a bug and I agree that your fix is correct. Will merge manually and issue a release.
Closing.
Thanks!
No branches or pull requests
In the case where if (currentBlock.get() < blocksize) is false, the CSVRecord e is lost. You'll notice this as a missing row for each block.
My solution was to remove the conditional logic for processing e, and add the conditional logic only in the part where the block is processed.
Here is my updated code:
` try (CSVParser parser = new CSVParser(fbr, sortOptions.getFormat())) {
parser.spliterator().forEachRemaining(e -> {
if (e.getRecordNumber() <= sortOptions.getNumHeader()) {
header[0] = e;
} else {
tmplist.add(e);
currentBlock.addAndGet(SizeEstimator.estimatedSizeOf(e));
}
if (currentBlock.get() >= blocksize) {
try {
files.add(sortAndSave(tmplist, tmpdirectory, sortOptions, header[0]));
} catch (IOException e1) {
logger.warn(String.format("Error during the sort in batch"),e1); //$NON-NLS-1$
}
tmplist.clear();
currentBlock.getAndSet(0);
}
`
The text was updated successfully, but these errors were encountered: