def init_binary_data(connect, collection, nb=3000, insert=True, partition_names=None): """ Generate entities and add it in collection """ ids = [] # global binary_entities global raw_vectors if nb == 3000: insert_entities = default_binary_entities insert_raw_vectors = raw_vectors else: insert_raw_vectors, insert_entities = ut.gen_binary_entities(nb) if insert is True: if partition_names is None: ids = connect.insert(collection, insert_entities) else: ids = connect.insert(collection, insert_entities, partition_name=partition_names) connect.flush([collection]) return insert_raw_vectors, insert_entities, ids
import pdb import logging import pytest from pymilvus import DataType import utils as ut default_entities = ut.gen_entities(ut.default_nb, is_normal=True) raw_vectors, default_binary_entities = ut.gen_binary_entities(ut.default_nb) default_int_field_name = "int64" default_float_field_name = "float" default_pos = 5 default_term_expr = f'{default_int_field_name} in {[i for i in range(default_pos)]}' def init_data(connect, collection, nb=ut.default_nb, partition_names=None, auto_id=True): """ Generate entities and add it in collection """ if nb == 3000: insert_entities = default_entities else: insert_entities = ut.gen_entities(nb, is_normal=True) if partition_names is None: if auto_id: ids = connect.insert(collection, insert_entities)
import utils default_fields = utils.gen_default_fields() default_binary_fields = utils.gen_default_fields(binary=True) default_entity = utils.gen_entities(1) default_raw_binary_vector, default_binary_entity = utils.gen_binary_entities(1) default_entities = utils.gen_entities(utils.default_nb) default_raw_binary_vectors, default_binary_entities = utils.gen_binary_entities( utils.default_nb)