Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TILEDB_GIT_REPOSITORY=https://github.com/TileDB-Inc/TileDB
TILEDB_GIT_TAG=2.0.0-rc5
TILEDB_GIT_TAG=2.0.0
TILEDB_VERBOSE=OFF
TILEDB_S3=OFF
TILEDB_HDFS=OFF
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/io/tiledb/java/api/Dimension.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,38 @@ public Dimension<T> setFilterList(FilterList filters) throws TileDBError {
return this;
}

/**
* Sets the number of values per cell for the dimension.
*
* @param cellValNum The number of values per cell
* @throws TileDBError
*/
public void setCellValNum(long cellValNum) throws TileDBError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add another helper function for public bool isVarLength() or isVar (whatever you prefer). It should just be something like return getCellValNum() == TILEDB_VAR_NUM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that @Shelnutt2. Gonna add this in the next PR

try {
ctx.handleError(
tiledb.tiledb_dimension_set_cell_val_num(ctx.getCtxp(), dimensionp, cellValNum));
} catch (TileDBError error) {
throw error;
}
}

/**
* Retrieves the number of values per cell for the dimension.
*
* @return The number of values per cell
* @throws TileDBError
*/
public long getCellValNum() throws TileDBError {
SWIGTYPE_p_unsigned_int uint = tiledb.new_uintp();
try {
ctx.handleError(tiledb.tiledb_dimension_get_cell_val_num(ctx.getCtxp(), dimensionp, uint));

return tiledb.uintp_value(uint);
} catch (TileDBError error) {
throw error;
}
}

/**
* @return A string representation of the extent.
* @throws TileDBError A TileDB exception
Expand Down
20 changes: 20 additions & 0 deletions src/test/java/io/tiledb/java/api/DimensionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,24 @@ public void testInvalidDimensionDatatype() throws Exception {
Assert.assertEquals("d1", dim.getName());
}
}

@Test
public void testSetCellValNum() throws Exception {
try (Context ctx = new Context();
Dimension<Integer> dim =
new Dimension<>(ctx, "d1", Datatype.TILEDB_INT32, new Pair<>(1, 10), 10)) {

dim.setCellValNum(1);
}
}

@Test
public void testGetCellValNum() throws Exception {
try (Context ctx = new Context();
Dimension<Integer> dim =
new Dimension<>(ctx, "d1", Datatype.TILEDB_INT32, new Pair<>(1, 10), 10)) {

Assert.assertEquals(1, dim.getCellValNum());
}
}
}