Conversation
17ee6b4 to
46252b1
Compare
46252b1 to
a66e4ab
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Fix the dangling timer reference and correct the negative-read assertion setup.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes mid-page EOS and negative-read handling in the Velox RSS sort shuffle reader and adds regression coverage.
Changes:
- Honors
throwIfPastEndand rejects negative reads. - Adds EOS and invalid-read tests.
- Registers the new Velox test target.
File summaries
| File | Summary |
|---|---|
cpp/velox/tests/VeloxShuffleReaderTest.cc |
Adds regression tests. Critical (3 votes): fixes needed for the dangling deserializeTime reference. Moderate (1 vote): the negative-read assertion must wrap deserializer construction. |
cpp/velox/tests/CMakeLists.txt |
Registers the reader test executable. |
cpp/velox/shuffle/VeloxShuffleReader.cc |
Implements EOS and negative-read handling. |
Review details
Suppressed comments (1)
cpp/velox/tests/VeloxShuffleReaderTest.cc:210
- The negative
Read()is triggered byVeloxInputStream's constructor (next(false)), somakeDeserializer(...)throws beforeVELOX_ASSERT_THROWis entered. As written, this test aborts at the helper assignment instead of passing through the assertion; wrap themakeDeserializercall itself inVELOX_ASSERT_THROW(or otherwise defer the negative return untilnext()).
auto deserializer =
makeDeserializer(std::make_shared<FakeInputStream>(std::vector<uint8_t>{}, /*negativeRead=*/true));
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
66c8ba7 to
24e9682
Compare
|
@ccat3z @kecookier it seems several Spark UT will hang there with this patch, please have a check |
…serializer GlutenByteInputStream::readBytes() drives next(true) in a for(;;) loop. When a page header declares more bytes than the stream actually holds (truncated partition data), the reader hits EOS mid-page — but VeloxInputStream::next() ignores its throwIfPastEnd argument and silently returns on EOS, so the loop never exits. This PR impl throwIfPassEnd arg of VeloxRssSortShuffleReaderDeserializer::VeloxInputStream::next()
24e9682 to
e5c015f
Compare
The UT failures seems unrelated to this PR. Let me rebase onto the latest main and retrigger UT. |
|
Cc @marin-ma |
| VELOX_CHECK_LT(0, realBytes, "Reading past end of file."); | ||
| setRange({buffer_->asMutable<uint8_t>(), realBytes, 0}); | ||
| offset_ = 0; | ||
| int64_t realBytes = in_->Read(readBytes, buffer_->asMutable<char>()).ValueOr(0); |
There was a problem hiding this comment.
Perhaps use GLUTEN_ASSIGN_OR_THROW here, and the check for realBytes can be removed.
What changes are proposed in this pull request?
GlutenByteInputStream::readBytes()drivesnext(true)in afor(;;)loop. When a page header declares more bytes than the stream actually holds (truncated partition data), the reader hits EOS mid-page — butVeloxInputStream::next()ignores its throwIfPastEnd argument and silently returns on EOS, so the loop never exits.This PR impl throwIfPassEnd arg of VeloxRssSortShuffleReaderDeserializer::VeloxInputStream::next(), fixed bug1 in #12985
How was this patch tested?
UT
Was this patch authored or co-authored using generative AI tooling?
Co-Authored-By: Claude