-
Notifications
You must be signed in to change notification settings - Fork 4
MINOR: Fix IOOBE in ListVector/LargeListVector.getFieldBuffers() for never-allocated offset buffer #27
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
MINOR: Fix IOOBE in ListVector/LargeListVector.getFieldBuffers() for never-allocated offset buffer #27
Changes from 7 commits
7637194
81ac711
3c64cb2
1a009d1
360a456
9a861c9
18b45a6
0d89f0a
e0979e8
2cd5472
00b69a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,8 +235,13 @@ public List<ArrowBuf> getFieldBuffers() { | |
| List<ArrowBuf> result = new ArrayList<>(2); | ||
| setReaderAndWriterIndex(); | ||
| result.add(validityBuffer); | ||
| if (offsetBuffer.capacity() == 0 && offsetBuffer.writerIndex() > 0) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. If it is not emptyVector issue, we may not know what should be the value in the offsetBuffer. Is it ok to be 0 in all indexes.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 2cd5472. Same tightening applied here: |
||
| long writerIdx = offsetBuffer.writerIndex(); | ||
| offsetBuffer.getReferenceManager().release(); | ||
| offsetBuffer = allocateOffsetBuffer(offsetAllocationSizeInBytes); | ||
| offsetBuffer.writerIndex(writerIdx); | ||
| } | ||
| result.add(offsetBuffer); | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
|
|
||
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.
The only further tightening I could think of is to check
offsetBuffer.capacity() < OFFSET_WIDTH, but I think the main issue was indeed withoffsetBuffer.capacity() == 0.Uh oh!
There was an error while loading. Please reload this page.
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.
If we are dealing with emptyVector issue, wouldn't be better to check if valueCount == 0 here. This seems to be fixing the unrelated issue where offset.capacity == 0 but with writerIndex was set incorrectly somewhere else.
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.
Fixed in 2cd5472. The guard is now scoped to
valueCount == 0, so this only handles the empty-vector serialization case. For non-empty vectors with a zero-capacity offset buffer we no longer synthesize zero offsets, since that would be an ambiguous/corrupt state rather than this bug.Uh oh!
There was an error while loading. Please reload this page.
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 think this approach may not fix the issue if
writeIndexwas set incorrectly.🤔 were there profiles of failed queries other than capacity = 0, writerIndex = 4?
Edit:
If
writerIndexis set incorrectly andcapacityis not zero (but say lesser than writerIndex), then I am not sure what else we could do here.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.
Exactly. Then it is a different issue in Apache Arrow. That I believe is beyond the scope of this fix
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.
From the customer profiles, I see this signature..
IndexOutOfBoundsException: readerIndex: 0, writerIndex: 4
Have to check in observe if all the profiles have it.. I checked in 10 profiles which Dmitry had given us
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.
Looks like this route is not the right way to fix.. there are more and more edge cases that we might hit.