jinchengchenghh commented on code in PR #11927:
URL: https://github.com/apache/gluten/pull/11927#discussion_r3074188647
##########
cpp/velox/jni/VeloxJniWrapper.cc:
##########
@@ -950,6 +953,16 @@ JNIEXPORT jlong JNICALL
Java_org_apache_gluten_vectorized_HashJoinBuilder_native
jlong bloomFilterPushdownSize,
jint numThreads) {
JNI_METHOD_START
+ auto ctx = getRuntime(env, wrapper);
+ facebook::velox::config::ConfigBase
queryConf(std::unordered_map<std::string, std::string>(ctx->getConfMap()));
Review Comment:
Please expose veloxCfg_ from veloxRuntime if you need it, and use veloxCfg_
as argument
##########
cpp/velox/jni/VeloxJniWrapper.cc:
##########
@@ -1015,36 +1044,73 @@ JNIEXPORT jlong JNICALL
Java_org_apache_gluten_vectorized_HashJoinBuilder_native
// Use thread pool (executor) instead of creating threads directly
auto executor = VeloxBackend::get()->executor();
+ auto overallStart = std::chrono::high_resolution_clock::now();
+ auto memoryPool = defaultLeafVeloxMemoryPool();
+
+ // Calculate total rows for monitoring
+ int64_t totalRows = 0;
+ for (const auto& batch : cb) {
+ auto veloxBatch =
VeloxColumnarBatch::from(defaultLeafVeloxMemoryPool().get(), batch);
+ totalRows += veloxBatch->getRowVector()->size();
Review Comment:
batch->numRows
##########
backends-velox/src/main/java/org/apache/gluten/vectorized/HashJoinBuilder.java:
##########
@@ -39,10 +39,12 @@ public long rtHandle() {
public static native long cloneHashTable(long hashTableData);
- public static native long nativeBuild(
+ public native long nativeBuild(
Review Comment:
static?
##########
cpp/velox/jni/VeloxJniWrapper.cc:
##########
@@ -1015,36 +1044,73 @@ JNIEXPORT jlong JNICALL
Java_org_apache_gluten_vectorized_HashJoinBuilder_native
// Use thread pool (executor) instead of creating threads directly
auto executor = VeloxBackend::get()->executor();
+ auto overallStart = std::chrono::high_resolution_clock::now();
+ auto memoryPool = defaultLeafVeloxMemoryPool();
+
+ // Calculate total rows for monitoring
+ int64_t totalRows = 0;
+ for (const auto& batch : cb) {
+ auto veloxBatch =
VeloxColumnarBatch::from(defaultLeafVeloxMemoryPool().get(), batch);
+ totalRows += veloxBatch->getRowVector()->size();
+ }
+
+ std::cout << "[HashBuild] Starting parallel hash table build: "
Review Comment:
LOG(INFO)
##########
cpp/velox/jni/VeloxJniWrapper.cc:
##########
@@ -1053,23 +1119,58 @@ JNIEXPORT jlong JNICALL
Java_org_apache_gluten_vectorized_HashJoinBuilder_native
// Wait for all tasks to complete
folly::collectAll(futures).wait();
+ auto buildEnd = std::chrono::high_resolution_clock::now();
+ auto buildMs = std::chrono::duration_cast<std::chrono::milliseconds>(
+ buildEnd - buildStart).count();
+ std::cout << "[HashBuild] Parallel build phase completed in " << buildMs <<
"ms" << std::endl;
+
+ auto mergeStart = std::chrono::high_resolution_clock::now();
+
auto mainTable = std::move(otherTables[0]);
std::vector<std::unique_ptr<facebook::velox::exec::BaseHashTable>> tables;
for (int i = 1; i < numThreads; ++i) {
tables.push_back(std::move(otherTables[i]));
}
+ uint64_t totalLocalRows = mainTable->rows()->numRows();
+ for (const auto& table : tables) {
+ totalLocalRows += table->rows()->numRows();
+ }
// TODO: Get accurate signal if parallel join build is going to be applied
// from hash table. Currently there is still a chance inside hash table that
// it might decide it is not going to trigger parallel join build.
const bool allowParallelJoinBuild = !tables.empty();
+ auto* executor1 = allowParallelJoinBuild ? VeloxBackend::get()->executor() :
nullptr;
+
+ std::cout << "[HashBuild] Starting merge phase, parallel=" <<
allowParallelJoinBuild << std::endl;
Review Comment:
Do you still need so much log?
--
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]