MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/arrow/acero/hash_join_node_test.cc:934–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934TEST(HashJoin, Suffix) {
935 BatchesWithSchema input_left;
936 input_left.batches = {ExecBatchFromJSON({int32(), int32(), int32()}, R"([
937 [1, 4, 7],
938 [2, 5, 8],
939 [3, 6, 9]
940 ])")};
941 input_left.schema = schema(
942 {field("lkey", int32()), field("shared", int32()), field("ldistinct", int32())});
943
944 BatchesWithSchema input_right;
945 input_right.batches = {ExecBatchFromJSON({int32(), int32(), int32()}, R"([
946 [1, 10, 13],
947 [2, 11, 14],
948 [3, 12, 15]
949 ])")};
950 input_right.schema = schema(
951 {field("rkey", int32()), field("shared", int32()), field("rdistinct", int32())});
952
953 BatchesWithSchema expected;
954 expected.batches = {
955 ExecBatchFromJSON({int32(), int32(), int32(), int32(), int32(), int32()}, R"([
956 [1, 4, 7, 1, 10, 13],
957 [2, 5, 8, 2, 11, 14],
958 [3, 6, 9, 3, 12, 15]
959 ])")};
960
961 expected.schema = schema({field("lkey", int32()), field("shared_l", int32()),
962 field("ldistinct", int32()), field("rkey", int32()),
963 field("shared_r", int32()), field("rdistinct", int32())});
964
965 AsyncGenerator<std::optional<ExecBatch>> sink_gen;
966
967 Declaration left{"source",
968 SourceNodeOptions{input_left.schema, input_left.gen(/*parallel=*/false,
969 /*slow=*/false)}};
970 Declaration right{
971 "source", SourceNodeOptions{input_right.schema, input_right.gen(/*parallel=*/false,
972 /*slow=*/false)}};
973 HashJoinNodeOptions join_opts{JoinType::INNER,
974 /*left_keys=*/{"lkey"},
975 /*right_keys=*/{"rkey"}, literal(true), "_l", "_r"};
976
977 Declaration join{"hashjoin", {std::move(left), std::move(right)}, join_opts};
978
979 ASSERT_OK_AND_ASSIGN(auto actual, DeclarationToExecBatches(std::move(join)));
980
981 AssertExecBatchesEqualIgnoringOrder(expected.schema, expected.batches, actual.batches);
982 AssertSchemaEqual(expected.schema, actual.schema);
983}
984
985TEST(HashJoin, Random) {
986 Random64Bit rng(42);

Callers

nothing calls this directly

Calls 15

ExecBatchFromJSONFunction · 0.85
default_memory_poolFunction · 0.85
GetCpuThreadPoolFunction · 0.85
GenRandomJoinTablesFunction · 0.85
GenJoinFieldRefsFunction · 0.85
NullInKeyFunction · 0.85
HashJoinSimpleFunction · 0.85
field_refFunction · 0.85
equalFunction · 0.85
to_stringFunction · 0.85
ArrayFromJSONFunction · 0.85

Tested by

no test coverage detected