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

Function makeUserBatch

test/api/arrow_complex_queries_test.cpp:53–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51};
52
53ArrowArrayWrapper makeUserBatch(const std::vector<UserRow>& rows) {
54 std::vector<int64_t> ids;
55 std::vector<std::string> names;
56 std::vector<int64_t> ages;
57 std::vector<int32_t> joinDates;
58 std::vector<std::vector<int64_t>> tags;
59 for (const auto& row : rows) {
60 ids.push_back(row.id);
61 names.emplace_back(row.name);
62 ages.push_back(row.age);
63 joinDates.push_back(row.joinDate);
64 tags.push_back(row.tags);
65 }
66 return createStructArray(static_cast<int64_t>(rows.size()),
67 {[&](ArrowArray* array) { createInt64Array(array, ids); },
68 [&](ArrowArray* array) { createStringArray(array, names); },
69 [&](ArrowArray* array) { createInt64Array(array, ages); },
70 [&](ArrowArray* array) { createDateArray(array, joinDates); },
71 [&](ArrowArray* array) { createListInt64Array(array, tags); }});
72}
73
74ArrowArrayWrapper makeCityBatch(const std::vector<CityRow>& rows) {
75 std::vector<int64_t> ids;

Callers 1

createUsersMethod · 0.85

Calls 8

createStructArrayFunction · 0.85
createInt64ArrayFunction · 0.85
createStringArrayFunction · 0.85
createDateArrayFunction · 0.85
createListInt64ArrayFunction · 0.85
emplace_backMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected