Skip to content

Commit c98e451

Browse files
authored
Add Support for Reading TILEDB_BLOB (#1159)
1 parent 777f6a7 commit c98e451

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## API Changes
44
* Use `bool` instead of `uint8` for Boolean dtype in `dataframe_.py` [#1154](https://github.com/TileDB-Inc/TileDB-Py/pull/1154)
55
* Support QueryCondition OR operator [#1146](https://github.com/TileDB-Inc/TileDB-Py/pull/1146)
6+
* Support `TILEDB_BLOB` dtype [#1159](https://github.com/TileDB-Inc/TileDB-Py/pull/1159)
67

78
## Bug Fixes
89
* Fix error where passing a `Context` to `Group` would segfault intermittenly [#1165](https://github.com/TileDB-Inc/TileDB-Py/pull/1165)

tiledb/cc/common.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ std::unordered_map<tiledb_datatype_t, std::string> _tdb_to_np_name_dtype = {
4141
{TILEDB_TIME_FS, "m8[fs]"},
4242
{TILEDB_TIME_AS, "m8[as]"},
4343
#endif
44-
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 7
45-
{TILEDB_BLOB, "bytes"},
44+
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 9
45+
{TILEDB_BLOB, "byte"},
4646
#endif
4747
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 10
4848
{TILEDB_BOOL, "bool"},
@@ -85,9 +85,6 @@ std::unordered_map<std::string, tiledb_datatype_t> _np_name_to_tdb_dtype = {
8585
{"timedelta64[fs]", TILEDB_TIME_FS},
8686
{"timedelta64[as]", TILEDB_TIME_AS},
8787
#endif
88-
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 7
89-
{"bytes", TILEDB_BLOB},
90-
#endif
9188
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 10
9289
{"bool", TILEDB_BOOL},
9390
#endif

tiledb/core.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ py::dtype tiledb_dtype(tiledb_datatype_t type, uint32_t cell_val_num) {
221221
case TILEDB_TIME_AS:
222222
return py::dtype("m8[as]");
223223
#endif
224-
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 7
224+
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 9
225225
case TILEDB_BLOB:
226-
return py::dtype("bytes");
226+
return py::dtype("byte");
227227
#endif
228228
#if TILEDB_VERSION_MAJOR >= 2 && TILEDB_VERSION_MINOR >= 10
229229
case TILEDB_BOOL:

tiledb/libtiledb.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ _tiledb_dtype_to_numpy_typeid_convert ={
111111
TILEDB_CHAR: np.NPY_STRING,
112112
TILEDB_STRING_UTF8: np.NPY_UNICODE,
113113
}
114+
IF LIBTILEDB_VERSION_MAJOR >= 2:
115+
IF LIBTILEDB_VERSION_MINOR >= 9:
116+
_tiledb_dtype_to_numpy_typeid_convert[TILEDB_BLOB] = np.NPY_BYTE
114117
IF LIBTILEDB_VERSION_MAJOR >= 2:
115118
IF LIBTILEDB_VERSION_MINOR >= 10:
116119
_tiledb_dtype_to_numpy_typeid_convert[TILEDB_BOOL] = np.NPY_BOOL
@@ -131,6 +134,9 @@ _tiledb_dtype_to_numpy_dtype_convert = {
131134
TILEDB_STRING_ASCII: np.bytes_,
132135
TILEDB_STRING_UTF8: np.dtype('U1'),
133136
}
137+
IF LIBTILEDB_VERSION_MAJOR >= 2:
138+
IF LIBTILEDB_VERSION_MINOR >= 9:
139+
_tiledb_dtype_to_numpy_dtype_convert[TILEDB_BLOB] = np.byte
134140
IF LIBTILEDB_VERSION_MAJOR >= 2:
135141
IF LIBTILEDB_VERSION_MINOR >= 10:
136142
_tiledb_dtype_to_numpy_dtype_convert[TILEDB_BOOL] = np.bool_

tiledb/tests/test_group.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,14 @@ def values_equal(lhs, rhs):
145145
assert values_equal(grp.meta["str"], str_data)
146146
grp.close()
147147

148-
# NOTE uncomment when deleting is "synced" in core
149-
# grp.open("w")
150-
# del grp.meta["int"]
151-
# grp.close()
152-
153-
# grp = tiledb.Group(grp_path, "r")
154-
# assert len(grp.meta) == 2
155-
# assert "int" not in grp.meta
156-
# grp.close()
148+
grp.open("w")
149+
del grp.meta["int"]
150+
grp.close()
151+
152+
grp = tiledb.Group(grp_path, "r")
153+
assert len(grp.meta) == 2
154+
assert "int" not in grp.meta
155+
grp.close()
157156

158157
def test_group_members(self, capfd):
159158
grp_path = self.path("test_group_members")

0 commit comments

Comments
 (0)