westonpace commented on a change in pull request #12110: URL: https://github.com/apache/arrow/pull/12110#discussion_r781445858
########## File path: cpp/src/arrow/compute/exec/hash_join_node.cc ########## @@ -294,8 +294,7 @@ std::shared_ptr<Schema> HashJoinSchema::MakeOutputSchema( proj_maps[side].data_type(HashJoinProjection::INPUT, input_field_id); std::string output_field_name = - (is_left ? left_field_name_prefix : right_field_name_prefix) + input_field_name; - + input_field_name + (is_left ? left_field_name_prefix : right_field_name_prefix); Review comment: Should these variables be renamed to `*_field_name_suffix`? ########## File path: cpp/src/arrow/compute/exec/hash_join_node_test.cc ########## @@ -937,6 +937,73 @@ void HashJoinWithExecPlan(Random64Bit& rng, bool parallel, ASSERT_OK_AND_ASSIGN(*output, TableFromExecBatches(output_schema, res)); } +TEST(HashJoin, Suffix) { + BatchesWithSchema input_left; + input_left.batches = {ExecBatchFromJSON({int32(), int32(), int32()}, R"([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9] + ])")}; + input_left.schema = schema( + {field("lkey", int32()), field("shared", int32()), field("ldistinct", int32())}); + + BatchesWithSchema input_right; + input_right.batches = {ExecBatchFromJSON({int32(), int32(), int32()}, R"([ + [1, 10, 13], + [2, 11, 14], + [3, 12, 15] + ])")}; + input_right.schema = schema( + {field("rkey", int32()), field("shared", int32()), field("rdistinct", int32())}); + + BatchesWithSchema expected; + expected.batches = { + ExecBatchFromJSON({int32(), int32(), int32(), int32(), int32(), int32()}, R"([ + [1, 4, 7, 1, 10, 13], + [2, 5, 8, 2, 11, 14], + [3, 6, 9, 3, 12, 15] + ])")}; + + expected.schema = schema({field("lkey_l", int32()), field("shared_l", int32()), + field("ldistinct_l", int32()), field("rkey_r", int32()), + field("shared_r", int32()), field("rdistinct_r", int32())}); Review comment: `lkey`, `ldistinct`, `rkey`, and `rdistinct` should not have the suffix added to them since they are distinct names. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org