Creating Dimensions

Creating a dimension requires specifying a name, the dimension datatype, the dimension domain and the space tile extent. Below you can see an example of creating an int32 dimension called dim with domain [1,4], and tile extent 2.

#include <tiledb/tiledb.h>

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

// Create dimension
int dim_domain[] = {1, 4};
int tile_extent = 2;
tiledb_dimension_t* dim;
tiledb_dimension_alloc(ctx, "dim", TILEDB_INT32, &dim_domain[0], &tile_extent, &dim);

// ...

// Create string dimension
// No values are accepted for domain and tile extent
tiledb_dimension_t* str_dim;
tiledb_dimension_alloc(ctx, "str_dim", TILEDB_STRING_ASCII, NULL, NULL, &str_dim);

// Make sure to free the dimension and context
tiledb_dimension_free(&dim);
tiledb_ctx_free(&ctx);

Supported Dimension Datatypes:

DatatypeDescriptionArray Type

TILEDB_STRING_ASCII

Variable length string

Sparse

TILEDB_INT8

8-bit integer

Dense & Sparse

TILEDB_UINT8

8-bit unsigned integer

Dense & Sparse

TILEDB_INT16

16-bit integer

Dense & Sparse

TILEDB_UINT16

16-bit unsigned integer

Dense & Sparse

TILEDB_INT32

32-bit integer

Dense & Sparse

TILEDB_UINT32

32-bit unsigned integer

Dense & Sparse

TILEDB_INT64

64-bit integer

Dense & Sparse

TILEDB_UINT64

64-bit unsigned integer

Dense & Sparse

TILEDB_FLOAT32

32-bit floating point

Sparse

TILEDB_FLOAT64

64-bit floating point

Sparse

TILEDB_DATETIME_YEAR

Years

Dense & Sparse

TILEDB_DATETIME_MONTH

Months

Dense & Sparse

TILEDB_DATETIME_WEEK

Weeks

Dense & Sparse

TILEDB_DATETIME_DAY

Days

Dense & Sparse

TILEDB_DATETIME_HR

Hours

Dense & Sparse

TILEDB_DATETIME_MIN

Minutes

Dense & Sparse

TILEDB_DATETIME_SEC

Seconds

Dense & Sparse

TILEDB_DATETIME_MS

Milliseconds

Dense & Sparse

TILEDB_DATETIME_US

Microseconds

Dense & Sparse

TILEDB_DATETIME_NS

Nanoseconds

Dense & Sparse

TILEDB_DATETIME_PS

Picoseconds

Dense & Sparse

TILEDB_DATETIME_FS

Femtoseconds

Dense & Sparse

TILEDB_DATETIME_AS

Attoseconds

Dense & Sparse

Setting Filters

Dimensions accept filters such as compressors. This is described in detail here.

Last updated