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

Function RunNonEmptyTest

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

Source from the content-addressed store, hash-verified

122}
123
124void RunNonEmptyTest(JoinType type, bool parallel) {
125 auto l_schema = schema({field("l_i32", int32()), field("l_str", utf8())});
126 auto r_schema = schema({field("r_str", utf8()), field("r_i32", int32())});
127 BatchesWithSchema l_batches, r_batches, exp_batches;
128
129 int multiplicity = parallel ? 100 : 1;
130
131 l_batches = GenerateBatchesFromString(
132 l_schema,
133 {R"([[0,"d"], [1,"b"]])", R"([[2,"d"], [3,"a"], [4,"a"]])",
134 R"([[5,"b"], [6,"c"], [7,"e"], [8,"e"]])"},
135 multiplicity);
136
137 r_batches = GenerateBatchesFromString(
138 r_schema,
139 {R"([["f", 0], ["b", 1], ["b", 2]])", R"([["c", 3], ["g", 4]])", R"([["e", 5]])"},
140 multiplicity);
141
142 switch (type) {
143 case JoinType::LEFT_SEMI:
144 exp_batches = GenerateBatchesFromString(
145 l_schema, {R"([[1,"b"]])", R"([])", R"([[5,"b"], [6,"c"], [7,"e"], [8,"e"]])"},
146 multiplicity);
147 break;
148 case JoinType::RIGHT_SEMI:
149 exp_batches = GenerateBatchesFromString(
150 r_schema, {R"([["b", 1], ["b", 2]])", R"([["c", 3]])", R"([["e", 5]])"},
151 multiplicity);
152 break;
153 case JoinType::LEFT_ANTI:
154 exp_batches = GenerateBatchesFromString(
155 l_schema, {R"([[0,"d"]])", R"([[2,"d"], [3,"a"], [4,"a"]])", R"([])"},
156 multiplicity);
157 break;
158 case JoinType::RIGHT_ANTI:
159 exp_batches = GenerateBatchesFromString(
160 r_schema, {R"([["f", 0]])", R"([["g", 4]])", R"([])"}, multiplicity);
161 break;
162 case JoinType::INNER:
163 case JoinType::LEFT_OUTER:
164 case JoinType::RIGHT_OUTER:
165 case JoinType::FULL_OUTER:
166 default:
167 FAIL() << "join type not implemented!";
168 }
169
170 CheckRunOutput(type, l_batches, r_batches,
171 /*left_keys=*/{{"l_str"}}, /*right_keys=*/{{"r_str"}}, exp_batches,
172 parallel);
173}
174
175void RunEmptyTest(JoinType type, bool parallel) {
176 auto l_schema = schema({field("l_i32", int32()), field("l_str", utf8())});

Callers 1

TEST_PFunction · 0.85

Calls 4

CheckRunOutputFunction · 0.70
schemaFunction · 0.50
fieldFunction · 0.50

Tested by

no test coverage detected