Skip to content

Commit 3d14e7d

Browse files
update to TileDB-2.17.3 and add support for Enum extend
1 parent 28b106c commit 3d14e7d

File tree

11 files changed

+207
-14
lines changed

11 files changed

+207
-14
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group 'io.tiledb'
12-
version '0.19.2-SNAPSHOT'
12+
version '0.19.3-SNAPSHOT'
1313

1414
repositories {
1515
jcenter()

cmake/Modules/FindTileDB_EP.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ if (NOT TILEDB_FOUND)
4848
# Try to download prebuilt artifacts unless the user specifies to build from source
4949
if(DOWNLOAD_TILEDB_PREBUILT)
5050
if (WIN32) # Windows
51-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.2/tiledb-windows-x86_64-2.17.2-06a09ae.zip")
52-
SET(DOWNLOAD_SHA1 "44120f41a4e6d625f2640f9201369c5cd5976e6c")
51+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.3/tiledb-windows-x86_64-2.17.3-0c2de58.zip")
52+
SET(DOWNLOAD_SHA1 "0eea09e813a7e748ec9cd66bf2a3b8430e8132c5")
5353
elseif(APPLE) # macOS
5454

5555
if (CMAKE_OSX_ARCHITECTURES STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
5656
message(STATUS "Building for intel mac")
57-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.2/tiledb-macos-x86_64-2.17.2-06a09ae.tar.gz")
58-
SET(DOWNLOAD_SHA1 "91de353b6f786e0b04557b3680065baab6650968")
57+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.3/tiledb-macos-x86_64-2.17.3-0c2de58.tar.gz")
58+
SET(DOWNLOAD_SHA1 "2132ff2544b80acbc37d71c317603225d20ddd76")
5959

6060
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL arm64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
6161
message(STATUS "Building for apple silicon mac")
62-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.2/tiledb-macos-arm64-2.17.2-06a09ae.tar.gz")
63-
SET(DOWNLOAD_SHA1 "eb5962b75a32f86ab42cfbb920ecce59a276d8f4")
62+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.3/tiledb-macos-arm64-2.17.3-0c2de58.tar.gz")
63+
SET(DOWNLOAD_SHA1 "222bb66496b8619fd6a87436104f8422aa8c1a2b")
6464
endif()
6565

6666
else() # Linux
67-
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.2/tiledb-linux-x86_64-2.17.2-06a09ae.tar.gz")
68-
SET(DOWNLOAD_SHA1 "456b0caa3c8fad936356d16e284431f1da56caba")
67+
SET(DOWNLOAD_URL "https://github.com/TileDB-Inc/TileDB/releases/download/2.17.3/tiledb-linux-x86_64-2.17.3-0c2de58.tar.gz")
68+
SET(DOWNLOAD_SHA1 "34c93c11aae7677f2a085f8d2c78e64d554688fe")
6969
endif()
7070

7171
ExternalProject_Add(ep_tiledb

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
TILEDB_GIT_REPOSITORY=https://github.com/TileDB-Inc/TileDB
2-
TILEDB_GIT_TAG=2.17.2
2+
TILEDB_GIT_TAG=2.17.3
33
TILEDB_VERBOSE=ON
44
TILEDB_S3=ON
55
TILEDB_AZURE=OFF

src/main/c/generated/tiledb_wrap.cxx

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12831,6 +12831,82 @@ SWIGEXPORT jlong JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1enumeration_
1283112831
}
1283212832

1283312833

12834+
SWIGEXPORT jlong JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1enumeration_1extend(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jobject jarg4, jlong jarg5, jobject jarg6, jlong jarg7) {
12835+
jlong jresult = 0 ;
12836+
tiledb_ctx_t *arg1 = (tiledb_ctx_t *) 0 ;
12837+
tiledb_enumeration_t *arg2 = (tiledb_enumeration_t *) 0 ;
12838+
void *arg3 = (void *) 0 ;
12839+
uint64_t arg4 ;
12840+
void *arg5 = (void *) 0 ;
12841+
uint64_t arg6 ;
12842+
tiledb_enumeration_t **arg7 = (tiledb_enumeration_t **) 0 ;
12843+
SwigValueWrapper< capi_return_t > result;
12844+
12845+
(void)jenv;
12846+
(void)jcls;
12847+
arg1 = *(tiledb_ctx_t **)&jarg1;
12848+
arg2 = *(tiledb_enumeration_t **)&jarg2;
12849+
arg3 = *(void **)&jarg3;
12850+
{
12851+
jclass clazz;
12852+
jmethodID mid;
12853+
jbyteArray ba;
12854+
jbyte* bae;
12855+
jsize sz;
12856+
int i;
12857+
12858+
if (!jarg4) {
12859+
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
12860+
return 0;
12861+
}
12862+
clazz = jenv->GetObjectClass(jarg4);
12863+
mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
12864+
ba = (jbyteArray)jenv->CallObjectMethod(jarg4, mid);
12865+
bae = jenv->GetByteArrayElements(ba, 0);
12866+
sz = jenv->GetArrayLength(ba);
12867+
arg4 = 0;
12868+
if (sz > 0) {
12869+
arg4 = (uint64_t)(signed char)bae[0];
12870+
for(i=1; i<sz; i++) {
12871+
arg4 = (arg4 << 8) | (uint64_t)(unsigned char)bae[i];
12872+
}
12873+
}
12874+
jenv->ReleaseByteArrayElements(ba, bae, 0);
12875+
}
12876+
arg5 = *(void **)&jarg5;
12877+
{
12878+
jclass clazz;
12879+
jmethodID mid;
12880+
jbyteArray ba;
12881+
jbyte* bae;
12882+
jsize sz;
12883+
int i;
12884+
12885+
if (!jarg6) {
12886+
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
12887+
return 0;
12888+
}
12889+
clazz = jenv->GetObjectClass(jarg6);
12890+
mid = jenv->GetMethodID(clazz, "toByteArray", "()[B");
12891+
ba = (jbyteArray)jenv->CallObjectMethod(jarg6, mid);
12892+
bae = jenv->GetByteArrayElements(ba, 0);
12893+
sz = jenv->GetArrayLength(ba);
12894+
arg6 = 0;
12895+
if (sz > 0) {
12896+
arg6 = (uint64_t)(signed char)bae[0];
12897+
for(i=1; i<sz; i++) {
12898+
arg6 = (arg6 << 8) | (uint64_t)(unsigned char)bae[i];
12899+
}
12900+
}
12901+
jenv->ReleaseByteArrayElements(ba, bae, 0);
12902+
}
12903+
arg7 = *(tiledb_enumeration_t ***)&jarg7;
12904+
result = tiledb_enumeration_extend(arg1,arg2,(void const *)arg3,arg4,(void const *)arg5,arg6,arg7);
12905+
*(capi_return_t **)&jresult = new capi_return_t((const capi_return_t &)result);
12906+
return jresult;
12907+
}
12908+
12909+
1283412910
SWIGEXPORT void JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1enumeration_1free(JNIEnv *jenv, jclass jcls, jlong jarg1) {
1283512911
tiledb_enumeration_t **arg1 = (tiledb_enumeration_t **) 0 ;
1283612912

@@ -14379,6 +14455,24 @@ SWIGEXPORT jlong JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1array_1schem
1437914455
}
1438014456

1438114457

14458+
SWIGEXPORT jlong JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1array_1schema_1evolution_1extend_1enumeration(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3) {
14459+
jlong jresult = 0 ;
14460+
tiledb_ctx_t *arg1 = (tiledb_ctx_t *) 0 ;
14461+
tiledb_array_schema_evolution_t *arg2 = (tiledb_array_schema_evolution_t *) 0 ;
14462+
tiledb_enumeration_t *arg3 = (tiledb_enumeration_t *) 0 ;
14463+
SwigValueWrapper< capi_return_t > result;
14464+
14465+
(void)jenv;
14466+
(void)jcls;
14467+
arg1 = *(tiledb_ctx_t **)&jarg1;
14468+
arg2 = *(tiledb_array_schema_evolution_t **)&jarg2;
14469+
arg3 = *(tiledb_enumeration_t **)&jarg3;
14470+
result = tiledb_array_schema_evolution_extend_enumeration(arg1,arg2,arg3);
14471+
*(capi_return_t **)&jresult = new capi_return_t((const capi_return_t &)result);
14472+
return jresult;
14473+
}
14474+
14475+
1438214476
SWIGEXPORT jlong JNICALL Java_io_tiledb_libtiledb_tiledbJNI_tiledb_1array_1schema_1evolution_1drop_1enumeration(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jstring jarg3) {
1438314477
jlong jresult = 0 ;
1438414478
tiledb_ctx_t *arg1 = (tiledb_ctx_t *) 0 ;

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ public void dropEnumeration(String name) throws TileDBError {
149149
ctx.getCtxp(), getEvolutionp(), name));
150150
}
151151

152+
/**
153+
* Extends an Enumeration during array schema evolution.
154+
*
155+
* @param enumeration The Enumeration to extend.
156+
* @throws TileDBError
157+
*/
158+
public void extendEnumeration(Enumeration enumeration) throws TileDBError {
159+
ctx.handleError(
160+
tiledb.tiledb_array_schema_evolution_extend_enumeration(
161+
ctx.getCtxp(), this.getEvolutionp(), enumeration.getEnumerationp()));
162+
}
163+
152164
/**
153165
* Evolves the schema of an array.
154166
*

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@ public boolean getOrdered() throws TileDBError {
119119
}
120120
}
121121

122+
/**
123+
* Extend an Enumeration.
124+
*
125+
* @param data A pointer to the enumeration value data to add.
126+
* @param dataSize The length of the data buffer provided.
127+
* @param offsets A pointer to the offsets buffer if enumeration is var sized.
128+
* @param offsetsSize The length of the offsets buffer, zero if no offsets.
129+
*/
130+
public Enumeration extend(
131+
NativeArray data, BigInteger dataSize, NativeArray offsets, BigInteger offsetsSize) {
132+
SWIGTYPE_p_p_tiledb_enumeration_t enumeration_t = tiledb.new_tiledb_enumeration_tpp();
133+
134+
try {
135+
ctx.handleError(
136+
tiledb.tiledb_enumeration_extend(
137+
ctx.getCtxp(),
138+
this.getEnumerationp(),
139+
data.toVoidPointer(),
140+
dataSize,
141+
offsets.toVoidPointer(),
142+
offsetsSize,
143+
enumeration_t));
144+
} catch (TileDBError e) {
145+
tiledb.delete_tiledb_enumeration_tpp(enumeration_t);
146+
}
147+
return new Enumeration(ctx, enumeration_t);
148+
}
149+
122150
/**
123151
* Return the datatype of the enumeration values
124152
*

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4663,6 +4663,26 @@ public static capi_return_t tiledb_enumeration_alloc(
46634663
true);
46644664
}
46654665

4666+
public static capi_return_t tiledb_enumeration_extend(
4667+
SWIGTYPE_p_tiledb_ctx_t ctx,
4668+
SWIGTYPE_p_tiledb_enumeration_t old_enumeration,
4669+
SWIGTYPE_p_void data,
4670+
java.math.BigInteger data_size,
4671+
SWIGTYPE_p_void offsets,
4672+
java.math.BigInteger offsets_size,
4673+
SWIGTYPE_p_p_tiledb_enumeration_t new_enumeration) {
4674+
return new capi_return_t(
4675+
tiledbJNI.tiledb_enumeration_extend(
4676+
SWIGTYPE_p_tiledb_ctx_t.getCPtr(ctx),
4677+
SWIGTYPE_p_tiledb_enumeration_t.getCPtr(old_enumeration),
4678+
SWIGTYPE_p_void.getCPtr(data),
4679+
data_size,
4680+
SWIGTYPE_p_void.getCPtr(offsets),
4681+
offsets_size,
4682+
SWIGTYPE_p_p_tiledb_enumeration_t.getCPtr(new_enumeration)),
4683+
true);
4684+
}
4685+
46664686
public static void tiledb_enumeration_free(SWIGTYPE_p_p_tiledb_enumeration_t enumeration) {
46674687
tiledbJNI.tiledb_enumeration_free(SWIGTYPE_p_p_tiledb_enumeration_t.getCPtr(enumeration));
46684688
}
@@ -5469,6 +5489,18 @@ public static capi_return_t tiledb_array_schema_evolution_add_enumeration(
54695489
true);
54705490
}
54715491

5492+
public static capi_return_t tiledb_array_schema_evolution_extend_enumeration(
5493+
SWIGTYPE_p_tiledb_ctx_t ctx,
5494+
SWIGTYPE_p_tiledb_array_schema_evolution_t array_schema_evolution,
5495+
SWIGTYPE_p_tiledb_enumeration_t enumeration) {
5496+
return new capi_return_t(
5497+
tiledbJNI.tiledb_array_schema_evolution_extend_enumeration(
5498+
SWIGTYPE_p_tiledb_ctx_t.getCPtr(ctx),
5499+
SWIGTYPE_p_tiledb_array_schema_evolution_t.getCPtr(array_schema_evolution),
5500+
SWIGTYPE_p_tiledb_enumeration_t.getCPtr(enumeration)),
5501+
true);
5502+
}
5503+
54725504
public static capi_return_t tiledb_array_schema_evolution_drop_enumeration(
54735505
SWIGTYPE_p_tiledb_ctx_t ctx,
54745506
SWIGTYPE_p_tiledb_array_schema_evolution_t array_schema_evolution,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ public interface tiledbConstants {
1717
public static final int TILEDB_OOM = (-2);
1818
public static final int TILEDB_VERSION_MAJOR = 2;
1919
public static final int TILEDB_VERSION_MINOR = 17;
20-
public static final int TILEDB_VERSION_PATCH = 0;
20+
public static final int TILEDB_VERSION_PATCH = 3;
2121
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,15 @@ public static final native long tiledb_enumeration_alloc(
15861586
java.math.BigInteger jarg9,
15871587
long jarg10);
15881588

1589+
public static final native long tiledb_enumeration_extend(
1590+
long jarg1,
1591+
long jarg2,
1592+
long jarg3,
1593+
java.math.BigInteger jarg4,
1594+
long jarg5,
1595+
java.math.BigInteger jarg6,
1596+
long jarg7);
1597+
15891598
public static final native void tiledb_enumeration_free(long jarg1);
15901599

15911600
public static final native long tiledb_enumeration_get_name(long jarg1, long jarg2, long jarg3);
@@ -1775,6 +1784,9 @@ public static final native int tiledb_array_schema_evolution_drop_attribute(
17751784
public static final native long tiledb_array_schema_evolution_add_enumeration(
17761785
long jarg1, long jarg2, long jarg3);
17771786

1787+
public static final native long tiledb_array_schema_evolution_extend_enumeration(
1788+
long jarg1, long jarg2, long jarg3);
1789+
17781790
public static final native long tiledb_array_schema_evolution_drop_enumeration(
17791791
long jarg1, long jarg2, String jarg3);
17801792

src/test/java/io/tiledb/java/api/DatatypeTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public void testEnumeratedDatatype() throws Exception {
147147
NativeArray enumsOffsets =
148148
new NativeArray(ctx, new long[] {0, 2, 4, 6}, Datatype.TILEDB_UINT64);
149149
NativeArray enums = new NativeArray(ctx, "aabbccdd", Datatype.TILEDB_STRING_ASCII);
150+
NativeArray enums2 = new NativeArray(ctx, "eeffgghh", Datatype.TILEDB_STRING_ASCII);
150151

151152
Enumeration en =
152153
new Enumeration(
@@ -294,7 +295,7 @@ public void testEnumeratedDatatype() throws Exception {
294295
ctx,
295296
"test_enum2",
296297
TILEDB_VAR_NUM,
297-
Datatype.TILEDB_INT32,
298+
Datatype.TILEDB_STRING_ASCII,
298299
false,
299300
enums,
300301
BigInteger.valueOf(enums.getSize() * Datatype.TILEDB_STRING_ASCII.getNativeSize()),
@@ -303,10 +304,24 @@ public void testEnumeratedDatatype() throws Exception {
303304
evolution.addEnumeration(en2);
304305
evolution.evolveArray(arrayURI);
305306

306-
// reopen array
307+
// test extend
307308
array = new Array(ctx, arrayURI);
308309
e = array.getEnumeration("test_enum2");
309310
Assert.assertEquals(e.getName(), "test_enum2");
311+
Enumeration newEnum =
312+
e.extend(
313+
enums2,
314+
BigInteger.valueOf(enums.getSize() * Datatype.TILEDB_STRING_ASCII.getNativeSize()),
315+
enumsOffsets,
316+
BigInteger.valueOf(enumsOffsets.getSize() * Datatype.TILEDB_UINT64.getNativeSize()));
317+
ArraySchemaEvolution extendEvolution = new ArraySchemaEvolution(ctx);
318+
extendEvolution.extendEnumeration(newEnum);
319+
extendEvolution.evolveArray(arrayURI);
320+
321+
// reopen array
322+
array = new Array(ctx, arrayURI);
323+
Enumeration extendedEnum = array.getEnumeration("test_enum2");
324+
Assert.assertEquals("aabbccddeeffgghh", new String((byte[]) extendedEnum.getData()));
310325
}
311326

312327
public void arrayCreate() throws Exception {

0 commit comments

Comments
 (0)