插入length为447的字符串,milvus为什么抛异常提示字符串超长? #25731
Replies: 3 comments
-
我现在知道第二个问题的原因了,在collection创建的时候设置了最大长度为1024。但是第一个问题我还是想请教下大家。 |
Beta Was this translation helpful? Give feedback.
-
since
你好,因为是中文,一个中文会占多个字符。Milvus的长度是按照byte算的 |
Beta Was this translation helpful? Give feedback.
-
milvus是按照utf-8下的字节长度进行计算的,比如“啦啦”这两个汉字,字符串长度是2,utf-8编码下的字节为b'\xe5\x95\xa6\xe5\x95\xa6',长度为6,所以假如设定某个milvus字段的varchar maxlength=4,那么插入啦啦这条数据的时候就会报错。 |
Beta Was this translation helpful? Give feedback.
-
我在验证milvus的时候,通过java sdk插入了一条数据,其中一个字段类型为VARCHAR,插入数据的字符串长度为447,但是milvus抛出异常:
R{exception=Exception: the length (1181) of 0th string exceeds max length (1024), status=1, data=null}
我有两个疑问:
Beta Was this translation helpful? Give feedback.
All reactions