MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / createLargeBatchComplexGraph

Function createLargeBatchComplexGraph

test/api/arrow_rel_table_test.cpp:357–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void createLargeBatchComplexGraph(main::Connection& connection) {
358 constexpr int64_t NUM_NODES = 2050;
359 constexpr int64_t NUM_EDGES = 2049;
360 constexpr int64_t NODE_SPLIT = 1025;
361 constexpr int64_t EDGE_SPLIT = 1025;
362
363 {
364 auto schema = makeComplexPersonSchema();
365 std::vector<PersonRow> batch0;
366 std::vector<PersonRow> batch1;
367 for (int64_t i = 0; i < NUM_NODES; ++i) {
368 auto row = PersonRow{i, "Person", 20 + (i % 40),
369 DATE_2020_01_01 + static_cast<int32_t>(i % 5), {i, i + 1}};
370 if (i < NODE_SPLIT) {
371 batch0.push_back(row);
372 } else {
373 batch1.push_back(row);
374 }
375 }
376 std::vector<ArrowArrayWrapper> arrays;
377 arrays.push_back(makePersonBatch(batch0));
378 arrays.push_back(makePersonBatch(batch1));
379 auto result = ArrowTableSupport::createViewFromArrowTable(connection, "lb_person",
380 std::move(schema), std::move(arrays));
381 ASSERT_TRUE(result.queryResult->isSuccess()) << result.queryResult->getErrorMessage();
382 }
383
384 {
385 auto schema = makeKnowsSchema();
386 std::vector<KnowsRow> batch0;
387 std::vector<KnowsRow> batch1;
388 for (int64_t i = 0; i < NUM_EDGES; ++i) {
389 KnowsRow row{i, i + 1, i, i < 3 ? "first3" : "rest",
390 i < 5 ? DATE_2020_01_01 : DATE_2021_01_01, {i % 3}};
391 if (i < EDGE_SPLIT) {
392 batch0.push_back(row);
393 } else {
394 batch1.push_back(row);
395 }
396 }
397 std::vector<ArrowArrayWrapper> arrays;
398 arrays.push_back(makeKnowsBatch(batch0));
399 arrays.push_back(makeKnowsBatch(batch1));
400 auto result = ArrowTableSupport::createRelTableFromArrowTable(connection, "lb_chain",
401 "lb_person", "lb_person", std::move(schema), std::move(arrays));
402 ASSERT_TRUE(result.queryResult->isSuccess()) << result.queryResult->getErrorMessage();
403 }
404}
405
406} // namespace
407

Callers 1

SetUpMethod · 0.85

Calls 7

makeComplexPersonSchemaFunction · 0.85
makePersonBatchFunction · 0.70
makeKnowsSchemaFunction · 0.70
makeKnowsBatchFunction · 0.70
push_backMethod · 0.45
isSuccessMethod · 0.45
getErrorMessageMethod · 0.45

Tested by

no test coverage detected