public class Array
extends java.lang.Object
implements java.lang.AutoCloseable
An Array object represents array data in TileDB at some persisted location, e.g. on disk, in
an S3 bucket, etc. Once an array has been opened for reading or writing, interact with the data
through Query
objects.
Example:
// Create an ArraySchema, add attributes, domain, etc.
Context ctx = new Context();
ArraySchema schema = new ArraySchema(...);
// Create empty array named "my_array" on persistent storage.
Array.create("my_array", schema);
Constructor and Description |
---|
Array(Context ctx,
java.lang.String uri)
Constructs an Array object opening the array for reading.
|
Array(Context ctx,
java.lang.String uri,
java.math.BigInteger timestamp)
Constructs an Array object opening the array for reading at a user-given timestamp
(time-travelling).
|
Array(Context ctx,
java.lang.String uri,
QueryType query_type)
Constructs an Array object, opening the array for the given query type.
|
Array(Context ctx,
java.lang.String uri,
QueryType query_type,
java.math.BigInteger timestamp)
Constructs an Array object, opening the array for the given query type at a user-given
timestamp (time-travelling).
|
Array(Context ctx,
java.lang.String uri,
QueryType query_type,
EncryptionType encryption_type,
byte[] key)
Constructs an Array object, opening the encrypted array for the given query type.
|
Array(Context ctx,
java.lang.String uri,
QueryType query_type,
EncryptionType encryption_type,
byte[] key,
java.math.BigInteger timestamp)
Constructs an Array object, opening the encrypted array for the given query type.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Free's the native objects and closes the Array.
|
static void |
consolidate(Context ctx,
java.lang.String uri)
Consolidates the fragments of an array into a single fragment.
|
static void |
consolidate(Context ctx,
java.lang.String uri,
Config config)
Consolidates the fragments of an array into a single fragment.
|
static void |
consolidate(Context ctx,
java.lang.String uri,
EncryptionType encryption_type,
byte[] key)
Consolidates the fragments of an array into a single fragment.
|
static void |
consolidate(Context ctx,
java.lang.String uri,
EncryptionType encryption_type,
byte[] key,
Config config)
Consolidates the fragments of an array into a single fragment.
|
static void |
create(java.lang.String uri,
ArraySchema schema)
Creates a persisted TileDB array given an input
ArraySchema |
static void |
create(java.lang.String uri,
ArraySchema schema,
EncryptionType encryption_type,
byte[] key)
Creates an encrypted persisted TileDBArray given input
ArraySchema and encryption key |
void |
deleteMetadata(java.lang.String key)
Deletes a metadata key-value item from an open array.
|
static boolean |
exists(Context ctx,
java.lang.String uri)
Checks if a given URI is an existing TileDB array object
|
protected SWIGTYPE_p_tiledb_array_t |
getArrayp() |
Context |
getCtx() |
NativeArray |
getMetadata(java.lang.String key)
Get a metadata key-value item from an open array.
|
NativeArray |
getMetadata(java.lang.String key,
Datatype nativeType)
Get a metadata key-value item from an open array.
|
Pair<java.lang.String,NativeArray> |
getMetadataFromIndex(java.math.BigInteger index)
Gets a metadata item from an open array using an index.
|
Pair<java.lang.String,NativeArray> |
getMetadataFromIndex(long index)
Gets a metadata item from an open array using an index.
|
java.util.Map<java.lang.String,java.lang.Object> |
getMetadataMap()
Returns a HashMap with all array metadata in a key-value manner.
|
java.math.BigInteger |
getMetadataNum()
Gets the number of metadata items in an open array.
|
Pair |
getNonEmptyDomainFromIndex(long index)
Given a dimension's index, return the bounding coordinates for that dimension.
|
Pair |
getNonEmptyDomainFromName(java.lang.String name)
Given a dimension's name, return the bounding coordinates for that dimension.
|
Pair<java.lang.String,java.lang.String> |
getNonEmptyDomainVarFromIndex(long index)
Retrieves the non-empty domain from an array for a given dimension index.
|
Pair<java.lang.String,java.lang.String> |
getNonEmptyDomainVarFromName(java.lang.String name)
Retrieves the non-empty domain from an array for a given dimension name.
|
Pair<java.math.BigInteger,java.math.BigInteger> |
getNonEmptyDomainVarSizeFromIndex(long index)
Retrieves the non-empty domain range sizes from an array for a given dimension index.
|
Pair<java.math.BigInteger,java.math.BigInteger> |
getNonEmptyDomainVarSizeFromName(java.lang.String name)
Retrieves the non-empty domain range sizes from an array for a given dimension name.
|
QueryType |
getQueryType() |
ArraySchema |
getSchema() |
java.lang.String |
getUri() |
java.lang.Boolean |
hasMetadataKey(java.lang.String key)
Checks if the key is present in the Array metadata.
|
java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> |
maxBufferElements(NativeArray subarray)
Deprecated.
|
java.util.HashMap<java.lang.String,Pair> |
nonEmptyDomain()
Get the non-empty domain of an array, returning the bounding coordinates for each dimension.
|
void |
putMetadata(java.lang.String key,
NativeArray value)
Puts a metadata key-value item to an open array.
|
void |
putMetadata(java.lang.String key,
java.lang.Object buffer)
Puts a metadata key-value item to an open array.
|
static void |
vacuum(Context ctx,
java.lang.String arrayURI)
Cleans up the array, such as consolidated fragments and array metadata.
|
static void |
vacuum(Context ctx,
java.lang.String arrayURI,
Config config)
Cleans up the array, such as consolidated fragments and array metadata.
|
public Array(Context ctx, java.lang.String uri) throws TileDBError
Example:
Context ctx = new Context();
Array array new Array(ctx, "s3://bucket-name/array-name");
ctx
- TileDB contexturi
- The array URITileDBError
- A TileDB exceptionpublic Array(Context ctx, java.lang.String uri, java.math.BigInteger timestamp) throws TileDBError
Example:
Context ctx = new Context();
Array array new Array(ctx, "s3://bucket-name/array-name");
ctx
- TileDB contexturi
- The array URItimestamp
- The timestampTileDBError
- A TileDB exceptionpublic Array(Context ctx, java.lang.String uri, QueryType query_type) throws TileDBError
Example:
Context ctx = new Context();
Array array new Array(ctx, "s3://bucket-name/array-name", TILEDB_READ);
ctx
- TileDB contexturi
- The array URIquery_type
- Query type to open the array for.TileDBError
- A TileDB exceptionpublic Array(Context ctx, java.lang.String uri, QueryType query_type, java.math.BigInteger timestamp) throws TileDBError
Example:
Context ctx = new Context();
Array array new Array(ctx, "s3://bucket-name/array-name", TILEDB_READ);
ctx
- TileDB contexturi
- The array URIquery_type
- Query type to open the array for.timestamp
- The timestampTileDBError
- A TileDB exceptionpublic Array(Context ctx, java.lang.String uri, QueryType query_type, EncryptionType encryption_type, byte[] key) throws TileDBError
Example:
Context ctx = new Context();
String key = "0123456789abcdeF0123456789abcdeF";
Array array new Array(ctx, "s3://bucket-name/array-name",
TILEDB_READ,
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
ctx
- TileDB contexturi
- The array URIquery_type
- Query type to open the array forencryption_type
- The encryption type to usekey
- The encryption key to useTileDBError
- A TileDB exceptionpublic Array(Context ctx, java.lang.String uri, QueryType query_type, EncryptionType encryption_type, byte[] key, java.math.BigInteger timestamp) throws TileDBError
Example:
Context ctx = new Context();
String key = "0123456789abcdeF0123456789abcdeF";
Array array new Array(ctx, "s3://bucket-name/array-name",
TILEDB_READ,
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
ctx
- TileDB contexturi
- The array URIquery_type
- Query type to open the array forencryption_type
- The encryption type to usekey
- The encryption key to usetimestamp
- The timestampTileDBError
- A TileDB exceptionpublic static void consolidate(Context ctx, java.lang.String uri) throws TileDBError
All queries to the array before consolidation must be finalized before consolidation can begin. Consolidation temporarily aquires an exclusive lock on the array when finalizing the resulting merged fragment.
Example:
Context ctx = new Context();
Array.consolidate(ctx, "s3://bucket-name/array-name");
ctx
- TileDB context objecturi
- TileDB URI stringTileDBError
- A TileDB exceptionpublic static void consolidate(Context ctx, java.lang.String uri, Config config) throws TileDBError
All queries to the array before consolidation must be finalized before consolidation can begin. Consolidation temporarily aquires an exclusive lock on the array when finalizing the resulting merged fragment.
Example:
Context ctx = new Context();
Array.consolidate(ctx, "s3://bucket-name/array-name");
ctx
- TileDB context objecturi
- TileDB URI stringconfig
- A TileDB config object with configuration parameters for the consolidationTileDBError
- A TileDB exceptionpublic static void consolidate(Context ctx, java.lang.String uri, EncryptionType encryption_type, byte[] key) throws TileDBError
All queries to the array before consolidation must be finalized before consolidation can begin. Consolidation temporarily aquires an exclusive lock on the array when finalizing the resulting merged fragment.
Example:
Context ctx = new Context();
String key = "0123456789abcdeF0123456789abcdeF";
Array.consolidate(ctx, "s3://bucket-name/array-name",
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
ctx
- A TileDB Contexturi
- URI string to TileDB arrayencryption_type
- Encryption type the array is encrypted withkey
- A byte array key to decrypt arrayTileDBError
public static void consolidate(Context ctx, java.lang.String uri, EncryptionType encryption_type, byte[] key, Config config) throws TileDBError
All queries to the array before consolidation must be finalized before consolidation can begin. Consolidation temporarily aquires an exclusive lock on the array when finalizing the resulting merged fragment.
Example:
Context ctx = new Context();
String key = "0123456789abcdeF0123456789abcdeF";
Array.consolidate(ctx, "s3://bucket-name/array-name",
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
ctx
- A TileDB Contexturi
- URI string to TileDB arrayencryption_type
- Encryption type the array is encrypted withkey
- A byte array key to decrypt arrayconfig
- A TileDB config object with configuration parameters for the consolidationTileDBError
public static void vacuum(Context ctx, java.lang.String arrayURI) throws TileDBError
This method uses as the vacuum configuration the configuration instance that is encapsulated in the context (ctx) instance (ctx.getConfig()).
arrayURI
- The array URIctx
- The TileDB contextTileDBError
- A TileDB exceptionpublic static void vacuum(Context ctx, java.lang.String arrayURI, Config config) throws TileDBError
arrayURI
- The array URIctx
- The TileDB contextconfig
- The TileDB config that will be used for the vacuum processTileDBError
- A TileDB exceptionpublic static boolean exists(Context ctx, java.lang.String uri) throws TileDBError
ctx
- TileDB context objecturi
- TileDB URI array stringTileDBError
public static void create(java.lang.String uri, ArraySchema schema) throws TileDBError
ArraySchema
Example:
Array.create("my_array", schema);
uri
- The array URI stringschema
- The TileDB ArraySchemaTileDBError
- A TileDB exceptionpublic static void create(java.lang.String uri, ArraySchema schema, EncryptionType encryption_type, byte[] key) throws TileDBError
ArraySchema
and encryption key
Example:
String key = "0123456789abcdeF0123456789abcdeF";
Array.create("my_array", schema,
TILEDB_AES_256_GCM,
key.getBytes(StandardCharsets.UTF_8));
uri
- The array URI stringschema
- The TileDB ArraySchemaencryption_type
- The encryption type to usekey
- The encryption key to useTileDBError
- A TileDB exceptionpublic java.util.HashMap<java.lang.String,Pair> nonEmptyDomain() throws TileDBError
TileDBError
- A TileDB exceptionpublic Pair getNonEmptyDomainFromIndex(long index) throws TileDBError
index
- THe dimension's indexTileDBError
- A TileDB exceptionpublic Pair getNonEmptyDomainFromName(java.lang.String name) throws TileDBError
name
- THe dimension's nameTileDBError
- A TileDB exceptionpublic Pair<java.math.BigInteger,java.math.BigInteger> getNonEmptyDomainVarSizeFromIndex(long index) throws TileDBError
index
- The dimension indexTileDBError
- A TileDB exceptionpublic Pair<java.math.BigInteger,java.math.BigInteger> getNonEmptyDomainVarSizeFromName(java.lang.String name) throws TileDBError
name
- The dimension nameTileDBError
- A TileDB exceptionpublic Pair<java.lang.String,java.lang.String> getNonEmptyDomainVarFromIndex(long index) throws TileDBError
index
- The dimension indexTileDBError
- A TileDB exceptionpublic Pair<java.lang.String,java.lang.String> getNonEmptyDomainVarFromName(java.lang.String name) throws TileDBError
name
- The dimension nameTileDBError
- A TileDB exception@Deprecated public java.util.HashMap<java.lang.String,Pair<java.lang.Long,java.lang.Long>> maxBufferElements(NativeArray subarray) throws TileDBError
subarray
- Domain subarrayTileDBError
- A TileDB exceptionpublic NativeArray getMetadata(java.lang.String key) throws TileDBError
key
- a key to retrieve from the metadata key-valueTileDBError
- A TileDB exceptionpublic NativeArray getMetadata(java.lang.String key, Datatype nativeType) throws TileDBError
key
- a key to retrieve from the metadata key-valuenativeType
- The DatatypeTileDBError
- A TileDB exceptionpublic void deleteMetadata(java.lang.String key) throws TileDBError
key
- a key to delete from the metadata key-valueTileDBError
- A TileDB exceptionpublic java.math.BigInteger getMetadataNum() throws TileDBError
TileDBError
- A TileDB exceptionpublic Pair<java.lang.String,NativeArray> getMetadataFromIndex(long index) throws TileDBError
index
- index to retrieve metadata fromTileDBError
- A TileDB exceptionpublic Pair<java.lang.String,NativeArray> getMetadataFromIndex(java.math.BigInteger index) throws TileDBError
index
- index to retrieve metadata fromTileDBError
- A TileDB exceptionpublic java.util.Map<java.lang.String,java.lang.Object> getMetadataMap() throws TileDBError
TileDBError
public java.lang.Boolean hasMetadataKey(java.lang.String key) throws TileDBError
key
- a key to retrieve from the metadata key-valueTileDBError
- A TileDB exceptionpublic void putMetadata(java.lang.String key, java.lang.Object buffer) throws TileDBError
key
- a key to assign to the input valuebuffer
- the metadata to put into the Array metadataTileDBError
- A TileDB exceptionpublic void putMetadata(java.lang.String key, NativeArray value) throws TileDBError
key
- a key to assign to the input valuevalue
- the metadata to put into the Array metadataTileDBError
- A TileDB exceptionpublic Context getCtx()
public java.lang.String getUri()
public ArraySchema getSchema() throws TileDBError
TileDBError
public QueryType getQueryType()
protected SWIGTYPE_p_tiledb_array_t getArrayp()
public void close()
close
in interface java.lang.AutoCloseable