Skip to content

Conversation

@jiamingli-maker
Copy link
Contributor

/kind improvement
/assign @yanliang567

PR Summary

  • Migrate TestInsertString ORM cases to client v2:
    • test_milvus_client_insert_string_field_is_primary
    • test_milvus_client_insert_multi_string_fields
    • test_milvus_client_insert_string_field_length_exceed
    • test_milvus_client_insert_string_field_space_empty
    • test_milvus_client_insert_string_field_is_pk_and_empty
  • Split async insert tests into testcases/async_milvus_client/test_insert_async.py

@sre-ci-robot sre-ci-robot added the kind/improvement Changes related to something improve, likes ut and code refactor label Jan 16, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @jiamingli-maker, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the test suite's organization and consistency by migrating string insertion tests to the client v2 framework and isolating asynchronous insert tests into their own module. This refactoring enhances maintainability and aligns the tests with the current client architecture.

Highlights

  • Test Migration: Migrated five TestInsertString ORM cases related to string field insertion to the client v2 testing framework. These tests now reside in TestMilvusClientInsertString within test_milvus_client_insert.py.
  • Test Refactoring: Refactored asynchronous insert tests by moving the TestInsertAsync class and its associated test cases from test_milvus_client_insert.py to a new dedicated file: testcases/async_milvus_client/test_insert_async.py.
  • Test Cleanup: Removed the TestInsertString class entirely from tests/python_client/testcases/test_insert.py as its tests have been migrated.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sre-ci-robot sre-ci-robot added the size/L Denotes a PR that changes 100-499 lines. label Jan 16, 2026
@mergify mergify bot added the dco-passed DCO check passed. label Jan 16, 2026
@mergify mergify bot added the kind/test label Jan 16, 2026
@sre-ci-robot
Copy link
Contributor

[ci-v2-notice]
Notice: New ci-v2 system is enabled for this PR.

To rerun ci-v2 checks, comment with:

  • /ci-rerun-code-check // for ci-v2/code-check
  • /ci-rerun-build // for ci-v2/build
  • /ci-rerun-ut-integration // for ci-v2/ut-integration, will rerun ci-v2/build
  • /ci-rerun-ut-go // for ci-v2/ut-go, will rerun ci-v2/build
  • /ci-rerun-ut-cpp // for ci-v2/ut-cpp
  • /ci-rerun-ut // for all ci-v2/ut-integration, ci-v2/ut-go, ci-v2/ut-cpp, will rerun ci-v2/build
  • /ci-rerun-e2e-arm // for ci-v2/e2e-arm
  • /ci-rerun-e2e-default // for ci-v2/e2e-default

If you have any questions or requests, please contact @zhikunyao.

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jiamingli-maker
To complete the pull request process, please assign zhengbuqian after the PR has been reviewed.
You can assign the PR to them by writing /assign @zhengbuqian in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully migrates string insertion test cases to the v2 client and refactors asynchronous insertion tests into a dedicated file. The changes are well-organized and improve the test structure. I have identified a few areas for improvement, including a redundant conditional check, the use of a magic number that could be defined as a constant, and a test case with a potentially incorrect assertion regarding primary key uniqueness that requires clarification.

Comment on lines +2077 to +2079
self.flush(client, collection_name)
num_entities = self.get_collection_stats(client, collection_name)[0]
assert num_entities.get("row_count", None) == nb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This test asserts that after inserting nb rows with the same primary key (str_field_value), the number of entities in the collection is nb. This seems incorrect, as a primary key should be unique. After inserting multiple entities with the same primary key, only one entity (the last one) should remain, and the row count should be 1.

If this is the intended behavior of Milvus, it's quite surprising and should be documented. If not, this test might be incorrect or masking a bug in Milvus's primary key enforcement. Please verify the expected behavior for duplicate primary keys in a single insert batch.

Comment on lines +1952 to +1955
if field.dtype == DataType.VARCHAR:
string_values = cf.gen_string(default_nb)
for i, row in enumerate(rows):
row[field.name] = string_values[i]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The if field.dtype == DataType.VARCHAR: check is redundant because the string_fields parameter is always populated with VARCHAR fields from cf.gen_string_field. You can remove this check and un-indent the inner block to simplify the code.

            string_values = cf.gen_string(default_nb)
            for i, row in enumerate(rows):
                row[field.name] = string_values[i]

Comment on lines +1980 to +1991
schema = self.create_schema(client, enable_dynamic_field=False)[0]
schema.add_field(default_primary_key_field_name, DataType.INT64, is_primary=True, auto_id=False)
schema.add_field(default_vector_field_name, DataType.FLOAT_VECTOR, dim=default_dim)
schema.add_field(default_float_field_name, DataType.FLOAT)
schema.add_field(default_string_field_name, DataType.VARCHAR, max_length=65535)
self.create_collection(client, collection_name, dimension=default_dim, schema=schema)

# 2. Generate row data with string field exceeding max length (65535)
max_length = 65535
rng = np.random.default_rng(seed=19530)
rows = [{default_primary_key_field_name: i, default_vector_field_name: list(rng.random((1, default_dim))[0]),
default_float_field_name: i * 1.0, default_string_field_name: str(i)} for i in range(nb)]
# Generate a string that exceeds max length
long_string = cf.gen_str_by_length(length=max_length + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The value 65535 is used as a magic number in multiple places. It's better to define it as a constant variable max_length at the beginning of the test and use it throughout. This improves readability and maintainability by avoiding hardcoded values.

        max_length = 65535
        schema = self.create_schema(client, enable_dynamic_field=False)[0]
        schema.add_field(default_primary_key_field_name, DataType.INT64, is_primary=True, auto_id=False)
        schema.add_field(default_vector_field_name, DataType.FLOAT_VECTOR, dim=default_dim)
        schema.add_field(default_float_field_name, DataType.FLOAT)
        schema.add_field(default_string_field_name, DataType.VARCHAR, max_length=max_length)
        self.create_collection(client, collection_name, dimension=default_dim, schema=schema)

        # 2. Generate row data with string field exceeding max length (65535)
        rng = np.random.default_rng(seed=19530)
        # Generate a string that exceeds max length
        long_string = cf.gen_str_by_length(length=max_length + 1)

@mergify
Copy link
Contributor

mergify bot commented Jan 16, 2026

@jiamingli-maker go-sdk check failed, comment rerun go-sdk can trigger the job again.

@mergify mergify bot added the ci-passed label Jan 16, 2026
@jiamingli-maker
Copy link
Contributor Author

rerun go-sdk

@jiamingli-maker
Copy link
Contributor Author

/ci-rerun-e2e-arm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test ci-passed dco-passed DCO check passed. kind/improvement Changes related to something improve, likes ut and code refactor kind/test sig/testing size/L Denotes a PR that changes 100-499 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants