Skip to content

Commit

Permalink
Fix type-o
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Apr 19, 2024
1 parent c18e7d6 commit 740d063
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions morpheus/service/vdb/milvus_vector_db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,17 @@ def insert_dataframe(self,
column_names = [field.name for field in self._fields if not field.auto_id]

if truncate_long_strings:
for col in [column_names]:
if df[col].dtype == "object":
max_len = df[col].str.len().max()
for col in column_names:
str_series = df[col]
if str_series.dtype == "object":
max_len = str_series.str.len().max()
if max_len > MAX_STRING_LENGTH:
logger.warning(("Column '%s' has a string length of %d, larger than the max of %d "
"supported by Milvus, truncating"),
col,
max_len,
MAX_STRING_LENGTH)
df[col] = df[col].str.slice(0, MAX_STRING_LENGTH)
df[col] = str_series.str.slice(0, MAX_STRING_LENGTH)
logger.warning("Column '%s' has been truncated to a max length of %d", col, df[col].len().max())

# Note: dataframe columns has to be in the order of collection schema fields.s
Expand Down

0 comments on commit 740d063

Please sign in to comment.