Skip to content

Commit ce0ddb2

Browse files
authored
Merge pull request #153 from TileDB-Inc/victorgiannakouris/ch1881/support-dimension-val-num
Support Dimension Val Num [ch1881]
2 parents ecc6878 + 32e5813 commit ce0ddb2

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

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.0.0-rc5
2+
TILEDB_GIT_TAG=2.0.0
33
TILEDB_VERBOSE=OFF
44
TILEDB_S3=OFF
55
TILEDB_HDFS=OFF

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,38 @@ public Dimension<T> setFilterList(FilterList filters) throws TileDBError {
248248
return this;
249249
}
250250

251+
/**
252+
* Sets the number of values per cell for the dimension.
253+
*
254+
* @param cellValNum The number of values per cell
255+
* @throws TileDBError
256+
*/
257+
public void setCellValNum(long cellValNum) throws TileDBError {
258+
try {
259+
ctx.handleError(
260+
tiledb.tiledb_dimension_set_cell_val_num(ctx.getCtxp(), dimensionp, cellValNum));
261+
} catch (TileDBError error) {
262+
throw error;
263+
}
264+
}
265+
266+
/**
267+
* Retrieves the number of values per cell for the dimension.
268+
*
269+
* @return The number of values per cell
270+
* @throws TileDBError
271+
*/
272+
public long getCellValNum() throws TileDBError {
273+
SWIGTYPE_p_unsigned_int uint = tiledb.new_uintp();
274+
try {
275+
ctx.handleError(tiledb.tiledb_dimension_get_cell_val_num(ctx.getCtxp(), dimensionp, uint));
276+
277+
return tiledb.uintp_value(uint);
278+
} catch (TileDBError error) {
279+
throw error;
280+
}
281+
}
282+
251283
/**
252284
* @return A string representation of the extent.
253285
* @throws TileDBError A TileDB exception

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,24 @@ public void testInvalidDimensionDatatype() throws Exception {
5555
Assert.assertEquals("d1", dim.getName());
5656
}
5757
}
58+
59+
@Test
60+
public void testSetCellValNum() throws Exception {
61+
try (Context ctx = new Context();
62+
Dimension<Integer> dim =
63+
new Dimension<>(ctx, "d1", Datatype.TILEDB_INT32, new Pair<>(1, 10), 10)) {
64+
65+
dim.setCellValNum(1);
66+
}
67+
}
68+
69+
@Test
70+
public void testGetCellValNum() throws Exception {
71+
try (Context ctx = new Context();
72+
Dimension<Integer> dim =
73+
new Dimension<>(ctx, "d1", Datatype.TILEDB_INT32, new Pair<>(1, 10), 10)) {
74+
75+
Assert.assertEquals(1, dim.getCellValNum());
76+
}
77+
}
5878
}

0 commit comments

Comments
 (0)