New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++][Compute] Remove print statements from unit tests #30184
Comments
Dhruv Vats / @dhruv9vats: If so, could you please point me in the direction I should start looking, as in, the specific files? |
Weston Pace / @westonpace: I think this was detected on cpp/src/arrow/compute/exec/hash_join_node_test.cc Beyond that I don't have any list of files but all tests end in _test.cc and probably shouldn't have "cout" for the most part so that should be searchable. |
Dhruv Vats / @dhruv9vats: Also, from what I understand, on this line, the following code: std::cout << join_type_name << " " << key_cmp_str << " ";
key_types.Print();
std::cout << " payload_l: ";
payload_types[0].Print();
std::cout << " payload_r: ";
payload_types[1].Print();
std::cout << " num_rows_l = " << num_rows_l << " num_rows_r = " << num_rows_r
<< " batch size = " << batch_size
<< " parallel = " << (parallel ? "true" : "false");
std::cout << std::endl; Should turn into something like this: ARROW_SCOPED_TRACE(join_type_name, " ",
key_cmp_str, " ",
key_types.Print());
ARROW_SCOPED_TRACE(" payload_l: ", payload_types[0].Print());
ARROW_SCOPED_TRACE(" payload_r: ", payload_types[1].Print());
ARROW_SCOPED_TRACE(" num_rows_l = ", num_rows_l,
" num_rows_r = ", num_rows_r,
" batch size = ", batch_size,
" parallel = ", (parallel ? "true" : "false")); right? Also, the Print() method uses the SCOPED_TRACE macro internally too. |
Weston Pace / @westonpace: At a glance, it looks like that might be more information that is necessary to include in SCOPED_TRACE. For example, if "test case 7" always has 20 rows then you don't need to print both test case 7 AND 20 rows (just test case 7 is sufficient). It's possible some of those print statements were included for utility while debugging and developing the unit tests. That kind of print statement can be outright removed (and doesn't need to convert to scoped trace). |
Weston Pace / @westonpace: |
Weston Pace / @westonpace: |
Unit tests should avoid unconditional print statements, preferring
SCOPED_TRACE
,ARROW_SCOPED_TRACE
, or on-fail extra messages likeASSERT_EQ(1, 2) << "extra here";
. There are some in the hash join unit testsReporter: Ben Kietzman / @bkietz
Assignee: Dhruv Vats / @dhruv9vats
PRs and other links:
Note: This issue was originally created as ARROW-14641. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: