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

Function TestHashJoinDictionaryHelper

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

Source from the content-addressed store, hash-verified

1213}
1214
1215void TestHashJoinDictionaryHelper(
1216 JoinType join_type, JoinKeyCmp cmp,
1217 // Whether to run parallel hash join.
1218 // This requires generating multiple copies of each input batch on one side of the
1219 // join. Expected results will be automatically adjusted to reflect the multiplication
1220 // of input batches.
1221 bool parallel, Datum l_key, Datum l_payload, Datum r_key, Datum r_payload,
1222 Datum l_out_key, Datum l_out_payload, Datum r_out_key, Datum r_out_payload,
1223 // Number of rows at the end of expected output that represent rows from the right
1224 // side that do not have a match on the left side. This number is needed to
1225 // automatically adjust expected result when multiplying input batches on the left
1226 // side.
1227 int expected_num_r_no_match,
1228 // Whether to swap two inputs to the hash join
1229 bool swap_sides,
1230 // If true, send length=0 batches, if false, skip these batches
1231 bool send_empty_batches = true) {
1232 int64_t l_length = l_key.is_array() ? l_key.array()->length
1233 : l_payload.is_array() ? l_payload.array()->length
1234 : -1;
1235 int64_t r_length = r_key.is_array() ? r_key.array()->length
1236 : r_payload.is_array() ? r_payload.array()->length
1237 : -1;
1238 ARROW_DCHECK(l_length >= 0 && r_length >= 0);
1239
1240 constexpr int batch_multiplicity_for_parallel = 2;
1241
1242 // Split both sides into exactly two batches
1243 int64_t l_first_length = l_length / 2;
1244 int64_t r_first_length = r_length / 2;
1245 BatchesWithSchema l_batches, r_batches;
1246 l_batches.batches.resize(2);
1247 r_batches.batches.resize(2);
1248 ASSERT_OK_AND_ASSIGN(
1249 l_batches.batches[0],
1250 ExecBatch::Make({l_key.is_array() ? l_key.array()->Slice(0, l_first_length) : l_key,
1251 l_payload.is_array() ? l_payload.array()->Slice(0, l_first_length)
1252 : l_payload}));
1253 ASSERT_OK_AND_ASSIGN(
1254 l_batches.batches[1],
1255 ExecBatch::Make(
1256 {l_key.is_array()
1257 ? l_key.array()->Slice(l_first_length, l_length - l_first_length)
1258 : l_key,
1259 l_payload.is_array()
1260 ? l_payload.array()->Slice(l_first_length, l_length - l_first_length)
1261 : l_payload}));
1262 ASSERT_OK_AND_ASSIGN(
1263 r_batches.batches[0],
1264 ExecBatch::Make({r_key.is_array() ? r_key.array()->Slice(0, r_first_length) : r_key,
1265 r_payload.is_array() ? r_payload.array()->Slice(0, r_first_length)
1266 : r_payload}));
1267 ASSERT_OK_AND_ASSIGN(
1268 r_batches.batches[1],
1269 ExecBatch::Make(
1270 {r_key.is_array()
1271 ? r_key.array()->Slice(r_first_length, r_length - r_first_length)
1272 : r_key,

Callers 1

TESTFunction · 0.85

Calls 15

default_memory_poolFunction · 0.85
TableFromExecBatchesFunction · 0.85
is_arrayMethod · 0.80
resizeMethod · 0.80
push_backMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
MakeFunction · 0.50
schemaFunction · 0.50
fieldFunction · 0.50

Tested by

no test coverage detected