From f2efa042c991ba5bc8f24798bd7fd3ae5772c15b Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Sat, 11 May 2024 14:33:44 +0800 Subject: [PATCH] test: add more json datatype in import test cases Signed-off-by: zhuwenxing --- tests/python_client/common/bulk_insert_data.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/python_client/common/bulk_insert_data.py b/tests/python_client/common/bulk_insert_data.py index 599f8b44fe721..b9b46bee54c03 100644 --- a/tests/python_client/common/bulk_insert_data.py +++ b/tests/python_client/common/bulk_insert_data.py @@ -517,9 +517,17 @@ def gen_data_by_data_field(data_field, rows, start=0, float_vector=True, dim=128 elif data_field == DataField.bool_field: data = [random.choice([True, False]) for i in range(start, rows + start)] elif data_field == DataField.json_field: - data = pd.Series([json.dumps({ - gen_unique_str(): random.randint(-999999, 9999999) - }) for i in range(start, rows + start)], dtype=np.dtype("str")) + json_value = [ + 1, + 1.0, + "1", + [1, 2, 3], + ["1", "2", "3"], + [1, 2, "3"], + {"key": "value"}, + ] + + data = pd.Series([json.dumps(random.choice(json_value)) for i in range(start, rows + start)], dtype=np.dtype("str")) elif data_field == DataField.array_bool_field: data = pd.Series( [np.array([random.choice([True, False]) for _ in range(array_length)], dtype=np.dtype("bool"))