marin-ma commented on code in PR #12986:
URL: https://github.com/apache/gluten/pull/12986#discussion_r4027315416


##########
cpp/velox/shuffle/VeloxShuffleReader.cc:
##########
@@ -845,27 +845,31 @@ 
VeloxRssSortShuffleReaderDeserializer::VeloxInputStream::VeloxInputStream(
     std::shared_ptr<arrow::io::InputStream> input,
     facebook::velox::BufferPtr buffer)
     : in_(std::move(input)), buffer_(std::move(buffer)) {
-  next(true);
+  next(false);
 }
 
 bool VeloxRssSortShuffleReaderDeserializer::VeloxInputStream::hasNext() {
   if (offset_ == 0) {
     return false;
   }
   if (ranges()[0].position >= ranges()[0].size) {
-    next(true);
+    next(false);
     return offset_ != 0;
   }
   return true;
 }
 
 void VeloxRssSortShuffleReaderDeserializer::VeloxInputStream::next(bool 
throwIfPastEnd) {
   const uint32_t readBytes = buffer_->capacity();
-  offset_ = in_->Read(readBytes, buffer_->asMutable<char>()).ValueOr(0);
-  if (offset_ > 0) {
-    int32_t realBytes = offset_;
-    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);

Review Comment:
   Perhaps use `GLUTEN_ASSIGN_OR_THROW` here, and the check for `realBytes` can 
be removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to