Skip to content

Commit

Permalink
fix: Fix import array via bulkwriter (#2035) (#2036)
Browse files Browse the repository at this point in the history
When import via bulkwriter, for array type, we should specify datatype;
otherwise, it will default to double(for float32 array) and int64(for
int8, int16, int32 array).

issue: #2034,
milvus-io/milvus#31834

pr: #2035

Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper authored Apr 12, 2024
1 parent 7d75517 commit 64acef6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pymilvus/bulk_writer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ def _persist_parquet(self, local_path: str, **kwargs):
for val in self._buffer[k]:
arr.append(np.array(val, dtype=np.dtype("uint8")))
data[k] = pd.Series(arr)
elif field_schema.dtype == DataType.ARRAY:
dt = NUMPY_TYPE_CREATOR[field_schema.element_type.name]
arr = []
for val in self._buffer[k]:
arr.append(np.array(val, dtype=dt))
data[k] = pd.Series(arr)
elif field_schema.dtype.name in NUMPY_TYPE_CREATOR:
dt = NUMPY_TYPE_CREATOR[field_schema.dtype.name]
data[k] = pd.Series(self._buffer[k], dtype=dt)
Expand Down

0 comments on commit 64acef6

Please sign in to comment.