jiangjiangtian commented on code in PR #11140:
URL: 
https://github.com/apache/incubator-gluten/pull/11140#discussion_r2576828677


##########
cpp/velox/utils/VeloxBatchResizer.cc:
##########
@@ -78,22 +80,41 @@ std::shared_ptr<ColumnarBatch> VeloxBatchResizer::next() {
   if (cb->numRows() < minOutputBatchSize_) {
     auto vb = VeloxColumnarBatch::from(pool_, cb);
     auto rv = vb->getRowVector();
+    auto vector = std::static_pointer_cast<facebook::velox::BaseVector>(rv);
+    uint64_t numBytes = cb->numBytes();
+    if (numBytes > preferredBatchBytes_) {
+      // Input batch is too large. Just return it as is.
+      return cb;
+    }
     auto buffer = facebook::velox::RowVector::createEmpty(rv->type(), pool_);
     buffer->append(rv.get());
 
-    for (auto nextCb = in_->next(); nextCb != nullptr; nextCb = in_->next()) {
-      auto nextVb = VeloxColumnarBatch::from(pool_, nextCb);
-      auto nextRv = nextVb->getRowVector();
-      if (buffer->size() + nextRv->size() > maxOutputBatchSize_) {
+    // Call reset manully to potentially release memory
+    vector.reset();

Review Comment:
   I remove the four lines of code here.



-- 
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