Skip to content

Commit 92fb0e2

Browse files
authored
Add support for BLOB attribute type override in from_pandas (#2143)
1 parent f0267e6 commit 92fb0e2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tiledb/dataframe_.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ def from_dtype(cls, dtype, column_name, varlen_types=()):
203203
if isinstance(dtype, str) and dtype == "ascii":
204204
return cls("ascii", var=True)
205205

206+
if isinstance(dtype, str) and dtype == "blob":
207+
return cls(np.bytes_, var=True)
208+
206209
dtype = pd_types.pandas_dtype(dtype)
207210
# Note: be careful if you rearrange the order of the following checks
208211

tiledb/tests/test_pandas_dataframe.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,17 @@ def test_apply_dtype_index_ingest(self):
271271
{
272272
"a": np.random.random_sample(20),
273273
"b": [str(uuid.uuid4()) for _ in range(20)],
274+
"c": [np.random.bytes(10) for _ in range(20)],
274275
}
275276
),
276277
sparse=True,
277-
index_dims=["a", "b"],
278-
column_types={"a": np.float32, "b": np.bytes_},
278+
index_dims=["a", "b", "c"],
279+
column_types={"a": np.float32, "b": np.bytes_, "c": "blob"},
279280
)
280281
with tiledb.open(uri) as A:
281282
assert A.schema.domain.dim(0).dtype == np.float32
282283
assert A.schema.domain.dim(1).dtype == np.bytes_
284+
assert A.schema.domain.dim(2).dtype == np.bytes_
283285

284286
def test_apply_dtype_index_schema_only(self):
285287
uri = self.path("index_dtype_casted_dtype")

0 commit comments

Comments
 (0)