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

Function create_array_1d

test/src/unit-cppapi-fill_values.cc:54–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void create_array_1d(
55 const std::string& array_name,
56 bool nullable_attributes = false,
57 int32_t fill_int32 = tiledb::sm::constants::empty_int32,
58 std::string fill_char = std::string() + tiledb::sm::constants::empty_char,
59 std::array<double, 2> fill_double = {
60 {tiledb::sm::constants::empty_float64,
61 tiledb::sm::constants::empty_float64}}) {
62 Context ctx;
63 VFS vfs(ctx);
64
65 Domain domain(ctx);
66 auto d = Dimension::create<int32_t>(ctx, "d", {{1, 10}}, 5);
67 domain.add_dimension(d);
68
69 auto a1 = Attribute::create<int32_t>(ctx, "a1");
70 auto a2 = Attribute::create<std::string>(ctx, "a2");
71 auto a3 = Attribute::create<double>(ctx, "a3");
72
73 a1.set_nullable(nullable_attributes);
74 a2.set_nullable(nullable_attributes);
75 a3.set_nullable(nullable_attributes);
76
77 if (!nullable_attributes) {
78 a1.set_fill_value(&fill_int32, sizeof(fill_int32));
79 a2.set_fill_value(fill_char.c_str(), fill_char.size());
80 a3.set_cell_val_num(2);
81 a3.set_fill_value(fill_double.data(), 2 * sizeof(double));
82 } else {
83 a1.set_fill_value(&fill_int32, sizeof(fill_int32), 1);
84 a2.set_fill_value(fill_char.c_str(), fill_char.size(), 0);
85 a3.set_cell_val_num(2);
86 a3.set_fill_value(fill_double.data(), 2 * sizeof(double), 1);
87 }
88
89 ArraySchema schema(ctx, TILEDB_DENSE);
90 schema.set_domain(domain);
91 schema.add_attributes(a1, a2, a3);
92
93 Array::create(array_name, schema);
94}
95
96void write_array_1d_partial(
97 const std::string& array_name, bool nullable_attributes = false) {

Callers 1

Calls 8

c_strMethod · 0.80
add_dimensionMethod · 0.45
set_nullableMethod · 0.45
set_fill_valueMethod · 0.45
sizeMethod · 0.45
set_cell_val_numMethod · 0.45
dataMethod · 0.45
set_domainMethod · 0.45

Tested by

no test coverage detected