-
Notifications
You must be signed in to change notification settings - Fork 169
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
fix: Avoid exception caused by broadcasting empty result #92
Conversation
val expected = (0 until numParts).flatMap(_ => (0 until 5).map(i => i + 1)).sorted | ||
|
||
assert(rowContents === expected) | ||
Seq(true, false).foreach { emptyBroadcast => |
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.
Hmm, the test looks complicated by the change. Could you add a new test for empty broadcast case instead of modifying current one?
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.
sure, added
@@ -81,7 +81,11 @@ abstract class CometExec extends CometPlan { | |||
|
|||
out.flush() | |||
out.close() | |||
Iterator((count, cbbos.toChunkedByteBuffer)) | |||
if (out.size() > 0) { |
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 is due to the extra bytes being written in the encode compressed stream, causing it to be determined not empty in CometExec$.decodeBatches.
If there are extra bytes written, is out.size()
0?
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.
Oh, I see. The compressed stream is wrapped in out
. When it is flushed, it might write compression related bytes which are not counted in out.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.
How about we check count > 0
instead?
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 that is same.
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.
LGTM too
Merged, thanks! |
Which issue does this PR close?
Closes #91.
Rationale for this change
What changes are included in this PR?
How are these changes tested?