Reading Fragment Info

You can get information about the fragments for any array as follows:

#include <tiledb/tiledb.h>

// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// Create fragment info object
tiledb_fragment_info_t* fragment_info;
tiledb_fragment_info_alloc(ctx, array_name, &fragment_info);

// Load fragment
tiledb_fragment_info_load(ctx, fragment_info);

// Get number of written fragments.
uint32_t num;
tiledb_fragment_info_get_fragment_num(ctx, fragment_info, &num);

// Get fragment URI
const char* uri;
tiledb_fragment_info_get_fragment_uri(ctx, fragment_info, 0, &uri);

// Get fragment size
uint64_t size;
tiledb_fragment_info_get_fragment_size(ctx, fragment_info, 0, &size);

// Check if the fragment is dense or sparse.
int32_t dense;
tiledb_fragment_info_get_dense(ctx, fragment_info, 0, &dense);

// Get the fragment timestamp range
uint64_t start;
uint64_t end;
tiledb_fragment_info_get_timestamp_range(ctx, fragment_info, 0, &start, &end);

// Get the number of cells written to the fragment.
uint64_t cell_num;
tiledb_fragment_info_get_cell_num(ctx, fragment_info, 0, &cell_num);

// Get the format version of the fragment.
uint32_t version;
tiledb_fragment_info_get_version(ctx, fragment_info, 0, &version);

// Check if fragment has consolidated metadata.
tiledb_fragment_info_has_consolidated_metadata(
  ctx, fragment_info, 0, &consolidated);

// Get the number of fragments with unconsolidated metadata
//  in the fragment info object.
int32_t consolidated;
uint32_t unconsolidated;
tiledb_fragment_info_get_unconsolidated_metadata_num(
    ctx, fragment_info, &unconsolidated);

// Get non-empty domain from index
uint64_t non_empty_dom[2];
tiledb_fragment_info_get_non_empty_domain_from_index(
  ctx, fragment_info, 0, 0, &non_empty_dom[0]);

// Clean up
tiledb_fragment_info_free(&fragment_info);
tiledb_ctx_free(&ctx);

Last updated