MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / create_array

Function create_array

examples/cpp_api/array_schema_evolution.cc:44–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42std::string array_uri("array_schema_evolution_array");
43
44void create_array(const Context& ctx) {
45 // The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4].
46 Domain domain(ctx);
47 domain.add_dimension(Dimension::create<int>(ctx, "rows", {{1, 4}}, 4))
48 .add_dimension(Dimension::create<int>(ctx, "cols", {{1, 4}}, 4));
49
50 // The array will be sparse.
51 ArraySchema schema(ctx, TILEDB_SPARSE);
52 schema.set_domain(domain).set_order({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}});
53
54 // Add a single attribute "a" so each (i,j) cell can store an integer.
55 schema.add_attribute(Attribute::create<int>(ctx, "a"));
56
57 // Create the (empty) array on disk.
58 Array::create(ctx, array_uri, schema);
59}
60
61void write_array(const Context& ctx) {
62 // Write some simple data to cells (1, 1), (2, 4) and (2, 3).

Callers 1

mainFunction · 0.70

Calls 3

add_dimensionMethod · 0.45
set_domainMethod · 0.45
add_attributeMethod · 0.45

Tested by

no test coverage detected