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


##########
cpp/velox/operators/reader/ParquetReaderIterator.cc:
##########
@@ -39,11 +39,11 @@ std::shared_ptr<facebook::velox::common::ScanSpec> 
makeScanSpec(const facebook::
 ParquetReaderIterator::ParquetReaderIterator(
     const std::string& path,
     int64_t batchSize,
-    facebook::velox::memory::MemoryPool* pool)
-    : FileReaderIterator(path), pool_(pool), batchSize_(batchSize) {}
+    std::shared_ptr<facebook::velox::memory::MemoryPool> pool)
+    : FileReaderIterator(path), pool_(std::move(pool)), batchSize_(batchSize) 
{}
 
 void ParquetReaderIterator::createRowReader() {
-  facebook::velox::dwio::common::ReaderOptions readerOptions{pool_};
+  facebook::velox::dwio::common::ReaderOptions readerOptions{pool_.get()};

Review Comment:
   Why change the pool to std::shared_ptr<facebook::velox::memory::MemoryPool> 
pool



##########
cpp/core/jni/JniCommon.cc:
##########
@@ -91,6 +88,8 @@ gluten::JniColumnarBatchIterator::JniColumnarBatchIterator(
       getMethodIdOrError(env, serializedColumnarBatchIteratorClass_, 
"hasNext", "()Z");
   serializedColumnarBatchIteratorNext_ = getMethodIdOrError(env, 
serializedColumnarBatchIteratorClass_, "next", "()J");
   jColumnarBatchItr_ = env->NewGlobalRef(jColumnarBatchItr);
+
+  shouldDump_ = runtime->getDumper() != nullptr;

Review Comment:
   make shouldDump_ a const member



##########
cpp/velox/benchmarks/GenericBenchmark.cc:
##########
@@ -457,33 +457,34 @@ auto BM_Generic = [](::benchmark::State& state,
         ArrowSchema cSchema;
         toArrowSchema(veloxPlan->outputType(), 
runtime->memoryManager()->getLeafMemoryPool().get(), &cSchema);
         GLUTEN_ASSIGN_OR_THROW(auto outputSchema, 
arrow::ImportSchema(&cSchema));
-        auto writer = std::make_shared<VeloxArrowWriter>(
-            FLAGS_save_output, FLAGS_batch_size, 
runtime->memoryManager()->getLeafMemoryPool().get());
+
+        auto writer = std::make_shared<VeloxColumnarBatchWriter>(
+            FLAGS_save_output, FLAGS_batch_size, 
runtime->memoryManager()->getAggregateMemoryPool());
+
         state.PauseTiming();
-        if (!FLAGS_save_output.empty()) {
-          GLUTEN_THROW_NOT_OK(writer->initWriter(*(outputSchema.get())));
-        }
+
         state.ResumeTiming();
 
         while (resultIter->hasNext()) {
-          auto array = resultIter->next()->exportArrowArray();
-          state.PauseTiming();
-          auto maybeBatch = arrow::ImportRecordBatch(array.get(), 
outputSchema);
-          if (!maybeBatch.ok()) {
-            state.SkipWithError(maybeBatch.status().message().c_str());
-            return;
+          auto cb = resultIter->next();
+          if (!FLAGS_save_output.empty()) {
+            GLUTEN_THROW_NOT_OK(writer->write(cb));
           }
           if (FLAGS_print_result) {
+            auto array = cb->exportArrowArray();

Review Comment:
   Do we still have ArrowBatch? Maybe print RowVector by vector->toString(0, 
20);



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