Skip to content

Commit ba2fb0e

Browse files
Added all TileDB 2.3.0 methods
1 parent a3cdc26 commit ba2fb0e

File tree

5 files changed

+188
-1
lines changed

5 files changed

+188
-1
lines changed

src/main/java/io/tiledb/java/api/Array.java

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,88 @@ public ArraySchema getSchema() throws TileDBError {
996996
return _schema;
997997
}
998998

999+
/**
1000+
* Sets the starting timestamp to use when opening (and reopening) the array. This is an inclusive
1001+
* bound. The default value is `0`.
1002+
*/
1003+
public void setOpenTimestampStart(BigInteger timestamp) throws TileDBError {
1004+
try {
1005+
ctx.handleError(
1006+
tiledb.tiledb_array_set_open_timestamp_start(ctx.getCtxp(), getArrayp(), timestamp));
1007+
} catch (TileDBError err) {
1008+
throw err;
1009+
}
1010+
}
1011+
1012+
/**
1013+
* Sets the ending timestamp to use when opening (and reopening) the array. This is an inclusive
1014+
* bound. The UINT64_MAX timestamp is a reserved timestamp that will be interpretted as the
1015+
* current timestamp when an array is opened. The default value is `UINT64_MAX`.
1016+
*/
1017+
public void setOpenTimestampEnd(BigInteger timestamp) throws TileDBError {
1018+
try {
1019+
ctx.handleError(
1020+
tiledb.tiledb_array_set_open_timestamp_end(ctx.getCtxp(), getArrayp(), timestamp));
1021+
} catch (TileDBError err) {
1022+
throw err;
1023+
}
1024+
}
1025+
1026+
/**
1027+
* Gets the starting timestamp used when opening (and reopening) the array. This is an inclusive
1028+
* bound.
1029+
*
1030+
* @throws TileDBError
1031+
*/
1032+
public long getOpenTimestampStart() throws TileDBError {
1033+
SWIGTYPE_p_unsigned_long_long start_t = tiledb.new_ullp();
1034+
try {
1035+
ctx.handleError(
1036+
tiledb.tiledb_array_get_open_timestamp_start(ctx.getCtxp(), getArrayp(), start_t));
1037+
} catch (TileDBError err) {
1038+
tiledb.delete_ullp(start_t);
1039+
throw err;
1040+
}
1041+
return tiledb.ullp_value(start_t).longValue();
1042+
}
1043+
1044+
/**
1045+
* Gets the ending timestamp used when opening (and reopening) the array. This is an inclusive
1046+
* bound. If UINT64_MAX was set, this will return the timestamp at the time the array was opened.
1047+
* If the array has not yet been opened, it will return UINT64_MAX.`
1048+
*/
1049+
public long getOpenTimestampEnd() throws TileDBError {
1050+
SWIGTYPE_p_unsigned_long_long end_t = tiledb.new_ullp();
1051+
try {
1052+
ctx.handleError(
1053+
tiledb.tiledb_array_get_open_timestamp_end(ctx.getCtxp(), getArrayp(), end_t));
1054+
} catch (TileDBError err) {
1055+
tiledb.delete_ullp(end_t);
1056+
throw err;
1057+
}
1058+
return tiledb.ullp_value(end_t).longValue();
1059+
}
1060+
1061+
/** Sets the array config. */
1062+
public void setConfig(Config config) throws TileDBError {
1063+
try {
1064+
ctx.handleError(
1065+
tiledb.tiledb_array_set_config(ctx.getCtxp(), getArrayp(), config.getConfigp()));
1066+
} catch (TileDBError err) {
1067+
throw err;
1068+
}
1069+
}
1070+
1071+
public Config getConfig() throws TileDBError {
1072+
SWIGTYPE_p_p_tiledb_config_t configpp = tiledb.new_tiledb_config_tpp();
1073+
try {
1074+
ctx.handleError(tiledb.tiledb_array_get_config(ctx.getCtxp(), getArrayp(), configpp));
1075+
} catch (TileDBError err) {
1076+
tiledb.delete_tiledb_config_tpp(configpp);
1077+
}
1078+
return new Config(configpp);
1079+
}
1080+
9991081
/**
10001082
* Reopens a TileDB array (the array must be already open). This is useful when the array got
10011083
* updated after it got opened. To sync-up with the updates, the user must either close the array
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package io.tiledb.java.api;
2+
3+
import io.tiledb.libtiledb.*;
4+
5+
public class Condition implements AutoCloseable {
6+
7+
private Context ctx;
8+
private SWIGTYPE_p_tiledb_query_condition_t conditionp;
9+
private SWIGTYPE_p_p_tiledb_query_condition_t conditionpp;
10+
11+
protected Condition(Context ctx, SWIGTYPE_p_p_tiledb_query_condition_t conditionpp) {
12+
this.ctx = ctx;
13+
// this.conditionp = tiledb.tiledb_filter_tpp_value(conditionpp);
14+
this.conditionp = tiledb.tiledb_query_condition_tpp_value(conditionpp);
15+
this.conditionpp = conditionpp;
16+
}
17+
18+
protected Condition(Context ctx) throws TileDBError {
19+
SWIGTYPE_p_p_tiledb_query_condition_t conditionpp = tiledb.new_tiledb_query_condition_tpp();
20+
try {
21+
ctx.handleError(tiledb.tiledb_query_condition_alloc(ctx.getCtxp(), conditionpp));
22+
} catch (TileDBError err) {
23+
tiledb.delete_tiledb_query_condition_tpp(conditionpp);
24+
throw err;
25+
}
26+
this.ctx = ctx;
27+
this.conditionp = tiledb.tiledb_query_condition_tpp_value(conditionpp);
28+
this.conditionpp = conditionpp;
29+
}
30+
31+
protected SWIGTYPE_p_tiledb_query_condition_t getConditionp() {
32+
return this.conditionp;
33+
}
34+
35+
protected Context getCtx() {
36+
return this.ctx;
37+
}
38+
39+
public void close() {
40+
if (conditionp != null && conditionpp != null) {
41+
tiledb.tiledb_query_condition_free(conditionpp);
42+
conditionpp = null;
43+
conditionp = null;
44+
}
45+
}
46+
}

src/main/java/io/tiledb/java/api/Context.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,23 @@ private void setDefaultTags() throws TileDBError {
224224
setTag("x-tiledb-api-sys-platform", platform);
225225
}
226226

227+
/**
228+
* @return Retrieves the stats from a TileDB context.
229+
* @exception TileDBError A TileDB exception
230+
*/
231+
public String getStats() throws TileDBError {
232+
String stats;
233+
SWIGTYPE_p_p_char statspp = tiledb.new_charpp();
234+
try {
235+
handleError(tiledb.tiledb_ctx_get_stats(getCtxp(), statspp));
236+
stats = tiledb.charpp_value(statspp);
237+
} finally {
238+
tiledb.delete_charpp(statspp);
239+
}
240+
241+
return stats;
242+
} // context file
243+
227244
/**
228245
* Close the context and delete all native objects. Should be called always to cleanup the context
229246
*/

src/main/java/io/tiledb/java/api/Query.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,48 @@ public String toString() {
17401740
return ""; // silence error
17411741
}
17421742

1743+
protected SWIGTYPE_p_tiledb_query_t getQueryp() {
1744+
return queryp;
1745+
}
1746+
1747+
/**
1748+
* @return Retrieves the stats from a Query.
1749+
* @exception TileDBError A TileDB exception
1750+
*/
1751+
public String getStats() throws TileDBError {
1752+
String stats;
1753+
SWIGTYPE_p_p_char statspp = tiledb.new_charpp();
1754+
try {
1755+
ctx.handleError(tiledb.tiledb_query_get_stats(ctx.getCtxp(), getQueryp(), statspp));
1756+
stats = tiledb.charpp_value(statspp);
1757+
} finally {
1758+
tiledb.delete_charpp(statspp);
1759+
}
1760+
1761+
return stats;
1762+
}
1763+
1764+
public void setCondition(Condition condition) {
1765+
// SWIGTYPE_p_p_tiledb_query_condition_t condition_t = tiledb.new_tiledb_quer
1766+
}
1767+
1768+
/**
1769+
* @return Retrieves the config from a Query.
1770+
* @exception TileDBError A TileDB exception
1771+
*/
1772+
public Config getConfig() throws TileDBError {
1773+
SWIGTYPE_p_p_tiledb_config_t configpp = tiledb.new_tiledb_config_tpp();
1774+
Config config;
1775+
try {
1776+
ctx.handleError(tiledb.tiledb_query_get_config(ctx.getCtxp(), this.queryp, configpp));
1777+
config = new Config(configpp);
1778+
} finally {
1779+
tiledb.delete_tiledb_config_tpp(configpp);
1780+
}
1781+
1782+
return config;
1783+
}
1784+
17431785
/** Free's native TileDB resources associated with the Query object */
17441786
@Override
17451787
public synchronized void close() {

src/main/java/io/tiledb/libtiledb/NativeLibLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ private static Path extractLibraryFile(
317317
*/
318318
private static Path findNativeLibrary(String libraryName, boolean mapLibraryName) {
319319
String mappedLibraryName = mapLibraryName ? System.mapLibraryName(libraryName) : libraryName;
320-
String libDir = LIB_RESOURCE_DIR;
320+
String libDir = LIB_RESOURCE_DIR + "/" + getOSClassifier();
321321
String libPath = libDir + "/" + mappedLibraryName;
322322

323323
boolean hasNativeLib = hasResource(libPath);

0 commit comments

Comments
 (0)