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

Function createStructSchema

test/include/arrow_test_utils.h:80–104  ·  view source on GitHub ↗

Helper to create a struct schema with multiple fields

Source from the content-addressed store, hash-verified

78
79// Helper to create a struct schema with multiple fields
80inline void createStructSchema(ArrowSchema* schema, int n_fields) {
81 schema->format = "+s"; // struct
82 schema->name = nullptr;
83 schema->metadata = nullptr;
84 schema->flags = 0;
85 schema->n_children = n_fields;
86 schema->children = static_cast<ArrowSchema**>(malloc(sizeof(ArrowSchema*) * n_fields));
87 for (int i = 0; i < n_fields; i++) {
88 schema->children[i] = static_cast<ArrowSchema*>(malloc(sizeof(ArrowSchema)));
89 }
90 schema->dictionary = nullptr;
91 schema->release = [](ArrowSchema* s) {
92 if (s->children) {
93 for (int64_t i = 0; i < s->n_children; i++) {
94 if (s->children[i]->release) {
95 s->children[i]->release(s->children[i]);
96 }
97 free(s->children[i]);
98 }
99 free(s->children);
100 }
101 s->release = nullptr;
102 };
103 schema->private_data = nullptr;
104}
105
106// Helper to create an int32 array from vector
107inline void createInt32Array(ArrowArray* array, const std::vector<int32_t>& data) {

Callers 15

makeSimplePersonSchemaFunction · 0.85
makeRelSchemaFunction · 0.85
makeSimpleCsrIndexSchemaFunction · 0.85
TEST_FFunction · 0.85
makeUserSchemaFunction · 0.85
makeCitySchemaFunction · 0.85
makeFollowsSchemaFunction · 0.85
makeLivesInSchemaFunction · 0.85
createUserTableMethod · 0.85
createCityTableMethod · 0.85
createFollowsTableMethod · 0.85

Calls 1

releaseMethod · 0.80

Tested by

no test coverage detected