From 08877e56f7dad9d160181cf957fa2dbeb6872bf7 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Mon, 18 Dec 2023 11:30:46 +0800 Subject: [PATCH] test: fix gen array field (#29247) fix gen array field Signed-off-by: zhuwenxing --- tests/python_client/common/common_func.py | 2 -- tests/python_client/testcases/test_bulk_insert.py | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/python_client/common/common_func.py b/tests/python_client/common/common_func.py index f85f273943732..45c171ba687f9 100644 --- a/tests/python_client/common/common_func.py +++ b/tests/python_client/common/common_func.py @@ -98,8 +98,6 @@ def gen_json_field(name=ct.default_json_field_name, description=ct.default_desc, def gen_array_field(name=ct.default_array_field_name, element_type=DataType.INT64, max_capacity=ct.default_max_capacity, description=ct.default_desc, is_primary=False, **kwargs): - if element_type == DataType.VARCHAR: - kwargs['max_length'] = ct.default_length array_field, _ = ApiFieldSchemaWrapper().init_field_schema(name=name, dtype=DataType.ARRAY, element_type=element_type, max_capacity=max_capacity, diff --git a/tests/python_client/testcases/test_bulk_insert.py b/tests/python_client/testcases/test_bulk_insert.py index 54936e0f1286d..c6991fe22d352 100644 --- a/tests/python_client/testcases/test_bulk_insert.py +++ b/tests/python_client/testcases/test_bulk_insert.py @@ -626,7 +626,7 @@ def test_with_all_field_json(self, auto_id, dim, entities, enable_dynamic_field) cf.gen_json_field(name=df.json_field), cf.gen_array_field(name=df.array_int_field, element_type=DataType.INT64), cf.gen_array_field(name=df.array_float_field, element_type=DataType.FLOAT), - cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR), + cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR, max_length=100), cf.gen_array_field(name=df.array_bool_field, element_type=DataType.BOOL), cf.gen_float_vec_field(name=df.vec_field, dim=dim), ] @@ -711,7 +711,7 @@ def test_bulk_insert_all_field_with_new_json_format(self, auto_id, dim, entities cf.gen_json_field(name=df.json_field), cf.gen_array_field(name=df.array_int_field, element_type=DataType.INT64), cf.gen_array_field(name=df.array_float_field, element_type=DataType.FLOAT), - cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR), + cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR, max_length=100), cf.gen_array_field(name=df.array_bool_field, element_type=DataType.BOOL), cf.gen_float_vec_field(name=df.vec_field, dim=dim), ] @@ -880,7 +880,7 @@ def test_bulk_insert_all_field_with_parquet(self, auto_id, dim, entities, file_n cf.gen_json_field(name=df.json_field), cf.gen_array_field(name=df.array_int_field, element_type=DataType.INT64), cf.gen_array_field(name=df.array_float_field, element_type=DataType.FLOAT), - cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR), + cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR, max_length=100), cf.gen_array_field(name=df.array_bool_field, element_type=DataType.BOOL), cf.gen_float_vec_field(name=df.vec_field, dim=dim), ] @@ -967,7 +967,7 @@ def test_with_wrong_parquet_file_num(self, auto_id, dim, entities, file_nums, ar cf.gen_double_field(name=df.double_field), cf.gen_array_field(name=df.array_int_field, element_type=DataType.INT64), cf.gen_array_field(name=df.array_float_field, element_type=DataType.FLOAT), - cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR), + cf.gen_array_field(name=df.array_string_field, element_type=DataType.VARCHAR, max_length=100), cf.gen_array_field(name=df.array_bool_field, element_type=DataType.BOOL), cf.gen_float_vec_field(name=df.vec_field, dim=dim), ]