jinchengchenghh commented on code in PR #9058:
URL: https://github.com/apache/incubator-gluten/pull/9058#discussion_r2002976063


##########
cpp/velox/memory/VeloxColumnarBatch.cc:
##########
@@ -45,25 +45,41 @@ RowVectorPtr makeRowVector(
 }
 } // namespace
 
+void VeloxColumnarBatch::doFlatten(std::shared_ptr<BaseVector>& child) {
+  facebook::velox::BaseVector::flattenVector(child);
+  if (child->isLazy()) {
+    child = child->as<facebook::velox::LazyVector>()->loadedVectorShared();
+    VELOX_DCHECK_NOT_NULL(child);
+  }
+  // In case of output from Limit, RowVector size can be smaller than its 
children size.
+  if (child->size() > rowVector_->size()) {
+    child = child->slice(0, rowVector_->size());
+  }
+}
+
 void VeloxColumnarBatch::ensureFlattened() {
   if (flattened_) {
     return;
   }
   ScopedTimer timer(&exportNanos_);
   for (auto& child : rowVector_->children()) {
-    facebook::velox::BaseVector::flattenVector(child);
-    if (child->isLazy()) {
-      child = child->as<facebook::velox::LazyVector>()->loadedVectorShared();
-      VELOX_DCHECK_NOT_NULL(child);
-    }
-    // In case of output from Limit, RowVector size can be smaller than its 
children size.
-    if (child->size() > rowVector_->size()) {
-      child = child->slice(0, rowVector_->size());
-    }
+    doFlatten(child);
   }
   flattened_ = true;
 }
 
+// Only flatten the columns specificed by columnIndices
+void VeloxColumnarBatch::ensurePartialFlattened(const std::vector<int32_t>& 
columnIndices) {
+  if (flattened_) {
+    return;
+  }
+  ScopedTimer timer(&exportNanos_);
+  for (auto indice : columnIndices) {
+    auto& child = rowVector_->children()[indice];

Review Comment:
   childAt(indice)



##########
cpp/velox/memory/VeloxColumnarBatch.cc:
##########
@@ -45,25 +45,41 @@ RowVectorPtr makeRowVector(
 }
 } // namespace
 
+void VeloxColumnarBatch::doFlatten(std::shared_ptr<BaseVector>& child) {

Review Comment:
   std::shared_ptr<BaseVector> -> VectorPtr



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