Ask or search…
K
Links

Reading Fragment Info

You can get information about the fragments for any array as follows:
C
C++
Python
R
Java
Go
C#
#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);
#include <tiledb/fragment_info.h>
// Create fragment info object
FragmentInfo fragment_info(ctx, array_uri);
// Load fragment
fragment_info.load();
// Get number of written fragments.
uint32_t num = fragment_info.fragment_num();
// Get URI of a fragment, a single parameter of the fragment index is used
std::string uri = fragment_info.fragment_uri(0);
// Get fragment size
uint64_t size = fragment_info.fragment_size(0);
// Check if the fragment is dense or sparse.
bool dense = fragment_info.dense(0);
// Get the fragment timestamp range
std::pair<uint64_t, uint64_t> timestamps = fragment_info.timestamp_range(0);
// Get the number of cells written to the fragment.
uint64_t cell_num = fragment_info.cell_num(0);
// Get the format version of the fragment.
uint32_t version = fragment_info.version(0);
// Check if fragment has consolidated metadata.
bool consolidated = fragment_info.has_consolidated_metadata(0);
// Get the number of fragments with unconsolidated metadata
// in the fragment info object.
uint32_t unconsolidated = fragment_info.unconsolidated_metadata_num();
// Get non-empty domain from index
uint64_t non_empty_dom[2];
fragment_info.get_non_empty_domain(0, 0, &non_empty_dom[0]);
import tiledb
fragments_info = tiledb.array_fragments(array_uri)
# Number of fragments
print(len(fragments_info))
# URI of given fragment, with 0 <= idx < numfrag
print(fragments_info.uri[idx])
# Timestamp range of given fragment, with 0 <= idx < numfrag
print(fragments_info.timestamp_range[idx])
## Fragment info
fraginf <- tiledb_fragment_info(uri)
## number of fragments
fi_num <- tiledb_fragment_info_get_num(fraginf)
## uri of fragment 'idx'
fi_uri <- tiledb_fragment_info_uri(fraginf, idx)
## size of first fragment
fi_sz <- tiledb_fragment_info_get_size(fraginf, idx)
## boolean for dense or sparse
is_dense <- tiledb_fragment_info_dense(fraginf, idx)
is_sparse <- tiledb_fragment_info_sparse(fraginf, idx)
## timestamp range for fragment
rng <- tiledb_fragment_info_get_timestamp_range(fraginf, idx)
FragmentInfo info = new FragmentInfo(ctx, "<array-uri>");
// Number of fragments
long numFragments = info.getFragmentNum();
// URI of given fragment, with 0 <= idx < numFragments
for (int i = 0; i < numFragments; ++i) {
System.out.println(info.getFragmentURI(i));
Pair<Long, Long> range = info.getTimestampRange(i);
}
TODO
using TileDB.CSharp;
// Create fragment info object
using FragmentInfo fragmentInfo = new(ctx, array_uri);
// Load fragment
fragmentInfo.Load();
// Get number of written fragments.
uint num = fragmentInfo.FragmentCount;
// Get URI of a fragment, a single parameter of the fragment index is used
string uri = fragmentInfo.GetFragmentUri(0);
// Get fragment size
ulong size = fragmentInfo.GetFragmentSize(0);
// Check if the fragment is dense or sparse.
bool dense = fragmentInfo.IsDense(0);
// Get the fragment timestamp range
(ulong timestampStart, ulong timestampEnd) = fragmentInfo.GetTimestampRange(0);
// Get the number of cells written to the fragment.
ulong cell_num = fragmentInfo.GetCellsWritten(0);
// Get the format version of the fragment.
uint version = fragmentInfo.GetFormatVersion(0);
// Check if fragment has consolidated metadata.
bool consolidated = fragmentInfo.HasConsolidatedMetadata(0);
// Get the number of fragments with unconsolidated metadata
// in the fragment info object.
uint unconsolidated = fragmentInfo.FragmentWithUnconsolidatedMetadataCount;
// Get non-empty domain from index
(ulong start, ulong end) = fragmentInfo.GetNonEmptyDomain<ulong>(0, 0);