From d7339d2fbfd5e7d3b412af45ae09477147e98c06 Mon Sep 17 00:00:00 2001 From: yangchuan Date: Fri, 29 Dec 2023 09:54:47 +0800 Subject: [PATCH] fix --- cpp/core/jni/JniCommon.h | 2 ++ cpp/core/shuffle/LocalPartitionWriter.cc | 1 + cpp/velox/benchmarks/common/OrcReaderIterator.h | 7 +++++++ cpp/velox/benchmarks/common/ParquetReaderIterator.h | 8 ++++++++ cpp/velox/compute/VeloxPlanConverter.cc | 1 + 5 files changed, 19 insertions(+) diff --git a/cpp/core/jni/JniCommon.h b/cpp/core/jni/JniCommon.h index 468224899cb27..085cb2af13f99 100644 --- a/cpp/core/jni/JniCommon.h +++ b/cpp/core/jni/JniCommon.h @@ -105,11 +105,13 @@ static inline jmethodID getStaticMethodIdOrError(JNIEnv* env, jclass thisClass, static inline void attachCurrentThreadAsDaemonOrThrow(JavaVM* vm, JNIEnv** out) { int getEnvStat = vm->GetEnv(reinterpret_cast(out), jniVersion); if (getEnvStat == JNI_EDETACHED) { + DLOG(INFO) << "JNIEnv was not attached to current thread."; // Reattach current thread to JVM getEnvStat = vm->AttachCurrentThreadAsDaemon(reinterpret_cast(out), NULL); if (getEnvStat != JNI_OK) { throw gluten::GlutenException("Failed to reattach current thread to JVM."); } + DLOG(INFO) << "Succeeded attaching current thread."; return; } if (getEnvStat != JNI_OK) { diff --git a/cpp/core/shuffle/LocalPartitionWriter.cc b/cpp/core/shuffle/LocalPartitionWriter.cc index 91225f7b5211a..3e944c0e93f21 100644 --- a/cpp/core/shuffle/LocalPartitionWriter.cc +++ b/cpp/core/shuffle/LocalPartitionWriter.cc @@ -128,6 +128,7 @@ class FlushOnSpillEvictHandle final : public LocalPartitionWriter::LocalEvictHan ARROW_ASSIGN_OR_RAISE(auto start, os_->Tell()); RETURN_NOT_OK(arrow::ipc::WriteIpcPayload(*payload, options_, os_.get(), &metadataLength)); ARROW_ASSIGN_OR_RAISE(auto end, os_->Tell()); + DLOG(INFO) << "Spilled partition " << partitionId << " file start: " << start << ", file end: " << end; spillInfo_->partitionSpillInfos.push_back({partitionId, end - start}); return arrow::Status::OK(); } diff --git a/cpp/velox/benchmarks/common/OrcReaderIterator.h b/cpp/velox/benchmarks/common/OrcReaderIterator.h index 4f68a598645fb..f8c9f44b20084 100644 --- a/cpp/velox/benchmarks/common/OrcReaderIterator.h +++ b/cpp/velox/benchmarks/common/OrcReaderIterator.h @@ -61,6 +61,7 @@ class OrcStreamReaderIterator final : public OrcReaderIterator { std::shared_ptr next() override { auto startTime = std::chrono::steady_clock::now(); GLUTEN_ASSIGN_OR_THROW(auto batch, recordBatchReader_->Next()); + DLOG(INFO) << "OrcStreamReaderIterator get a batch, num rows: " << (batch ? batch->num_rows() : 0); collectBatchTime_ += std::chrono::duration_cast(std::chrono::steady_clock::now() - startTime).count(); if (batch == nullptr) { @@ -76,6 +77,12 @@ class OrcBufferedReaderIterator final : public OrcReaderIterator { createReader(); collectBatches(); iter_ = batches_.begin(); + DLOG(INFO) << "OrcBufferedReaderIterator open file: " << path; + DLOG(INFO) << "Number of input batches: " << std::to_string(batches_.size()); + if (iter_ != batches_.cend()) { + DLOG(INFO) << "columns: " << (*iter_)->num_columns(); + DLOG(INFO) << "rows: " << (*iter_)->num_rows(); + } } std::shared_ptr next() override { diff --git a/cpp/velox/benchmarks/common/ParquetReaderIterator.h b/cpp/velox/benchmarks/common/ParquetReaderIterator.h index f80b244a27419..3858adce4bb56 100644 --- a/cpp/velox/benchmarks/common/ParquetReaderIterator.h +++ b/cpp/velox/benchmarks/common/ParquetReaderIterator.h @@ -50,11 +50,13 @@ class ParquetStreamReaderIterator final : public ParquetReaderIterator { public: explicit ParquetStreamReaderIterator(const std::string& path) : ParquetReaderIterator(path) { createReader(); + DLOG(INFO) << "ParquetStreamReaderIterator open file: " << path; } std::shared_ptr next() override { auto startTime = std::chrono::steady_clock::now(); GLUTEN_ASSIGN_OR_THROW(auto batch, recordBatchReader_->Next()); + DLOG(INFO) << "ParquetStreamReaderIterator get a batch, num rows: " << (batch ? batch->num_rows() : 0); collectBatchTime_ += std::chrono::duration_cast(std::chrono::steady_clock::now() - startTime).count(); if (batch == nullptr) { @@ -70,6 +72,12 @@ class ParquetBufferedReaderIterator final : public ParquetReaderIterator { createReader(); collectBatches(); iter_ = batches_.begin(); + DLOG(INFO) << "ParquetBufferedReaderIterator open file: " << path; + DLOG(INFO) << "Number of input batches: " << std::to_string(batches_.size()); + if (iter_ != batches_.cend()) { + DLOG(INFO) << "columns: " << (*iter_)->num_columns(); + DLOG(INFO) << "rows: " << (*iter_)->num_rows(); + } } std::shared_ptr next() override { diff --git a/cpp/velox/compute/VeloxPlanConverter.cc b/cpp/velox/compute/VeloxPlanConverter.cc index 6a89a21e93f00..678e4b8740808 100644 --- a/cpp/velox/compute/VeloxPlanConverter.cc +++ b/cpp/velox/compute/VeloxPlanConverter.cc @@ -211,6 +211,7 @@ std::shared_ptr VeloxPlanConverter::toVel } } auto veloxPlan = substraitVeloxPlanConverter_.toVeloxPlan(substraitPlan); + DLOG(INFO) << "Plan Node: " << std::endl << veloxPlan->toString(true, true); return veloxPlan; }