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

Function create_array

examples/cpp_api/query_condition_dense.cc:81–102  ·  view source on GitHub ↗

* @brief Function to create the TileDB array used in this example. * The array will be 1D with size 1 with dimension "index". * The bounds on the index will be 0 through 9, inclusive. * * The array has four attributes. The four attributes are * - "a" (type int) * - "b" (type std::string) * - "c" (type int32_t) * - "d" (type float) * * @param ctx The context. */

Source from the content-addressed store, hash-verified

79 * @param ctx The context.
80 */
81void create_array(Context& ctx) {
82 // Creating the domain and the dimensions.
83 Domain domain(ctx);
84 domain.add_dimension(
85 Dimension::create<int32_t>(ctx, "index", {{0, num_elems - 1}}));
86
87 // The array will be dense.
88 ArraySchema schema(ctx, TILEDB_DENSE);
89 schema.set_domain(domain).set_order({{TILEDB_ROW_MAJOR}});
90
91 // Adding the attributes of the array to the array schema.
92 Attribute a = Attribute::create<int>(ctx, "a").set_nullable(true);
93 Attribute b = Attribute::create<std::string>(ctx, "b");
94 Attribute c = Attribute::create<int32_t>(ctx, "c").set_fill_value(
95 &c_fill_value, sizeof(int32_t));
96 Attribute d = Attribute::create<float>(ctx, "d").set_fill_value(
97 &d_fill_value, sizeof(float));
98 schema.add_attribute(a).add_attribute(b).add_attribute(c).add_attribute(d);
99
100 // Create the (empty) array.
101 Array::create(ctx, array_name, schema);
102}
103
104/**
105 * @brief Execute a write on array query_condition_dense array

Callers 1

mainFunction · 0.70

Calls 5

add_dimensionMethod · 0.45
set_domainMethod · 0.45
set_nullableMethod · 0.45
set_fill_valueMethod · 0.45
add_attributeMethod · 0.45

Tested by

no test coverage detected