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.
New issue
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
GH-41560: [C++] ChunkResolver: Implement ResolveMany and add unit tests #41561
GH-41560: [C++] ChunkResolver: Implement ResolveMany and add unit tests #41561
Changes from 9 commits
3e2ff8f
99a2a4d
18c84ad
7d26515
848eaa3
eb7a1bd
d0db90f
dbfc796
ce7840b
f5a7d1d
5745c7d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean
logical_array_length()
rather thann
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it rather a pre-condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meaning the caller is supposed to pass the value of
out_chunk_index_vec[n_indices - 1]
from the previous call toResolveMany
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's the plan. Or 0 if
n_indices == 0
. That's why I didn't want to write the formula.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming
ResolveMany
will be invoked in batches? This condition doesn't need to be checked in eachResolveMany
call, only once for each call to the larger operation (such as Take). That's not necessarily a problem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be. I'm not doing it like that for
Take
at the moment. It's a very predictable branch though and I'm allowing it to be inlined at the caller.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't seem to be the case: if a logical index is negative, its unsigned counterpart will be out of bounds and the corresponding
out_chunk_index_vec
value will therefore be equal tochunks_.size()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. The overflow check guarantees it's impossible for negative logical indices to become valid indices.Not really.
INT8_MIN
becomes 128 when cast touint8_t
,-1
becomes255
, so depending on the chunks, they won't be an out-of-bounds logical indices.I'm tweaking the comment here and improving the tests.