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

Function read_timestamp_data

examples/cpp_api/quickstart_dimension_labels.cc:233–267  ·  view source on GitHub ↗

* Example reading data from one dimension label. * * @param ctx TileDB context to call TileDB API with. * @param array_uri URI of the array to read from. */

Source from the content-addressed store, hash-verified

231 * @param array_uri URI of the array to read from.
232 */
233void read_timestamp_data(const Context& ctx, const char* array_uri) {
234 printf("\nRead from dimension label\n");
235
236 // Open array for reading.
237 Array array(ctx, array_uri, TILEDB_READ);
238
239 // Create subarray for reading data.
240 // Note: Since we are only reading a dimension label on dimension 1, any
241 // ranges set on dimension 0 will be ignored.
242 Subarray subarray(ctx, array);
243 subarray.add_range(1, 1, 3);
244
245 // Create buffers to hold the output data.
246 std::vector<int64_t> timestamp(3);
247
248 // Create the query.
249 Query query(ctx, array);
250 query.set_subarray(subarray);
251 query.set_layout(TILEDB_ROW_MAJOR);
252 QueryExperimental::set_data_buffer(query, "timestamp", timestamp);
253 auto status = query.submit();
254 // Check the query finished.
255 if (status != Query::Status::COMPLETE) {
256 printf("Warning: Read query did not complete.\n");
257 }
258
259 // Print results.
260 for (unsigned j = 0; j < 3; ++j) {
261 int32_t sample_val = j + 1;
262 printf(" Cell (--, %d)\n", sample_val);
263 printf(" * timestamp(%d) = ", sample_val);
264 print_timestamp(timestamp[j]);
265 printf("\n");
266 }
267}
268
269/**
270 * Example reading data from the array by the dimension labels.

Callers 1

mainFunction · 0.70

Calls 5

print_timestampFunction · 0.70
add_rangeMethod · 0.45
set_subarrayMethod · 0.45
set_layoutMethod · 0.45
submitMethod · 0.45

Tested by

no test coverage detected