Skip to content

Commit 66e1e36

Browse files
committed
add debug prints in hashjoin
1 parent eb50407 commit 66e1e36

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

velox/experimental/cudf/exec/CudfHashJoin.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "velox/experimental/cudf/exec/ExpressionEvaluator.h"
1919
#include "velox/experimental/cudf/exec/ToCudf.h"
2020
#include "velox/experimental/cudf/exec/Utilities.h"
21+
#include "velox/experimental/cudf/exec/VeloxCudfInterop.h"
2122

2223
#include "velox/exec/Task.h"
2324

@@ -407,6 +408,25 @@ RowVectorPtr CudfHashJoinProbe::getOutput() {
407408
auto leftTableView = leftTable->view();
408409
auto rightTableView = rightTable->view();
409410

411+
// add env variable to print the table
412+
if (std::getenv("PRINT_TABLE") != nullptr && std::string(std::getenv("PRINT_TABLE")) == "1") {
413+
// debug print leftTable
414+
auto leftTableVelox = facebook::velox::cudf_velox::with_arrow::toVeloxColumn(leftTableView, pool(), "", stream);
415+
std::cout << "Left table: " << std::endl << leftTableVelox->toString();
416+
for (int i = 0; i < leftTableVelox->size(); i++) {
417+
std::cout << leftTableVelox->toString(i) << std::endl;
418+
}
419+
std::cout << std::endl << "--------------------------------" << std::endl;
420+
// debug print rightTable
421+
auto rightTableVelox = facebook::velox::cudf_velox::with_arrow::toVeloxColumn(rightTableView, pool(), "", stream);
422+
std::cout << "Right table: " << std::endl << rightTableVelox->toString();
423+
for (int i = 0; i < rightTableVelox->size(); i++) {
424+
std::cout << rightTableVelox->toString(i) << std::endl;
425+
}
426+
}
427+
428+
std::cout << std::endl << "--------------------------------" << std::endl;
429+
410430
if (joinNode_->isInnerJoin()) {
411431
// left = probe, right = build
412432
if (joinNode_->filter()) {
@@ -519,6 +539,9 @@ RowVectorPtr CudfHashJoinProbe::getOutput() {
519539
} else {
520540
VELOX_FAIL("Unsupported join type: ", joinNode_->joinType());
521541
}
542+
// print info about leftJoinIndices and rightJoinIndices
543+
std::cout << "Left join indices: " << leftJoinIndices->size() << std::endl;
544+
std::cout << "Right join indices: " << rightJoinIndices->size() << std::endl;
522545
auto leftIndicesSpan = leftJoinIndices
523546
? cudf::device_span<cudf::size_type const>{*leftJoinIndices}
524547
: cudf::device_span<cudf::size_type const>{};

0 commit comments

Comments
 (0)