Skip to content

Commit

Permalink
test: add more json datatype in import test cases
Browse files Browse the repository at this point in the history
Signed-off-by: zhuwenxing <[email protected]>
  • Loading branch information
zhuwenxing committed May 11, 2024
1 parent c61c9d9 commit f2efa04
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/python_client/common/bulk_insert_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit f2efa04

Please sign in to comment.