ORC: Fix non-vectorized reader incorrectly skipping rows#1706
Merged
Conversation
Contributor
Author
Contributor
|
This looks like a serious problem to me. Case 1 above seems very likely. Do we need to create any patch releases for this or stop the 0.10.0 release to get this into 0.10.0? (FYI @aokolnychyi) |
rdblue
approved these changes
Nov 2, 2020
Contributor
|
I'd be in favor of failing RC2 and including this in 0.10.0 |
Contributor
|
I ran the tests without the fix and they do break as expected. I'm going to merge this. |
Contributor
Author
|
I would also be in favor of including this in 0.10.0. Seems like this issue has been here since the very beginning and went unnoticed. Most of our test cases which check for correctness test on a small number of rows (100) and hence do no trigger this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ORC non-vectorized code path uses the following condition in
OrcRowIterator#next()to determine if a new batch should be read and row batch counter should be reset.if (batch == null || nextRow >= batch.size)(Note: the code usescurrentas the variable name instead ofbatch)Since the batch object is reused,
#hasNext()can cause a new batch to be loaded in case the existing batch was consumed. In such a case, the condition in#next()will cause the row batch counter to be reset. However, if#hasNext()was called prior to this, thebatchvariable will already have data loaded for the next batch and sobatch.sizewill give size of the newly loaded batch.In some cases, the batch sizes across batches will remain the same and so the current condition works fine. However, there can be cases where batch size of the next batch is greater than the current batch and so the condition
nextRow >= batch.sizewill be false even if a new batch was loaded causingnextRowto not be reset and rows from the new row batch being skipped.The conditions under which this case can occur:
This PR stores the current batch size in a local variable when the batch is loaded so that calls to
#hasNext()do not affect the condition in#next().