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

Method Make

cpp/src/arrow/acero/asof_join_node.cc:1375–1409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1373 }
1374
1375 static arrow::Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs,
1376 const ExecNodeOptions& options) {
1377 DCHECK_GE(inputs.size(), 2) << "Must have at least two inputs";
1378 const auto& join_options = checked_cast<const AsofJoinNodeOptions&>(options);
1379 ARROW_ASSIGN_OR_RAISE(size_t n_by, GetByKeySize(join_options.input_keys));
1380 size_t n_input = inputs.size();
1381 std::vector<std::string> input_labels(n_input);
1382 std::vector<std::shared_ptr<Schema>> input_schema(n_input);
1383 for (size_t i = 0; i < n_input; ++i) {
1384 input_labels[i] = i == 0 ? "left" : "right_" + ToChars(i);
1385 input_schema[i] = inputs[i]->output_schema();
1386 }
1387 ARROW_ASSIGN_OR_RAISE(std::vector<col_index_t> indices_of_on_key,
1388 GetIndicesOfOnKey(input_schema, join_options.input_keys));
1389 ARROW_ASSIGN_OR_RAISE(std::vector<std::vector<col_index_t>> indices_of_by_key,
1390 GetIndicesOfByKey(input_schema, join_options.input_keys));
1391 ARROW_ASSIGN_OR_RAISE(
1392 std::shared_ptr<Schema> output_schema,
1393 MakeOutputSchema(input_schema, indices_of_on_key, indices_of_by_key));
1394
1395 std::vector<std::unique_ptr<KeyHasher>> key_hashers;
1396 for (size_t i = 0; i < n_input; i++) {
1397 key_hashers.push_back(std::make_unique<KeyHasher>(i, indices_of_by_key[i]));
1398 }
1399 bool must_hash =
1400 n_by > 1 ||
1401 (n_by == 1 &&
1402 !is_primitive(
1403 inputs[0]->output_schema()->field(indices_of_by_key[0][0])->type()->id()));
1404 bool may_rehash = n_by == 1 && !must_hash;
1405 return plan->EmplaceNode<AsofJoinNode>(
1406 plan, inputs, std::move(input_labels), std::move(indices_of_on_key),
1407 std::move(indices_of_by_key), std::move(join_options), std::move(output_schema),
1408 std::move(key_hashers), must_hash, may_rehash);
1409 }
1410
1411 const char* kind_name() const override { return "AsofJoinNode"; }
1412 const Ordering& ordering() const override { return ordering_; }

Callers

nothing calls this directly

Calls 9

ToCharsFunction · 0.85
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
MakeOutputSchemaFunction · 0.70
is_primitiveFunction · 0.50
sizeMethod · 0.45
idMethod · 0.45
typeMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected