Skip to content

Commit

Permalink
test: fix gen array field (#29247)
Browse files Browse the repository at this point in the history
fix gen array field

Signed-off-by: zhuwenxing <[email protected]>
  • Loading branch information
zhuwenxing authored Dec 18, 2023
1 parent 4ab02da commit 08877e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions tests/python_client/common/common_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions tests/python_client/testcases/test_bulk_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
Expand Down Expand Up @@ -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),
]
Expand Down Expand Up @@ -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),
]
Expand Down Expand Up @@ -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),
]
Expand Down

0 comments on commit 08877e5

Please sign in to comment.