Skip to content

Conversation

@zhengbuqian
Copy link
Collaborator

issue: #47083

@sre-ci-robot sre-ci-robot added approved size/M Denotes a PR that changes 30-99 lines. labels Jan 15, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @zhengbuqian, 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 refines the automatic index selection strategy within the HybridScalarIndex component. For fields with high cardinality, the system will now default to using an STLSORT index instead of an INVERTED index, which was previously applied to non-integral primitive types and strings. This change aims to optimize index performance for high-cardinality data by standardizing the use of STLSORT in such scenarios. Additionally, the default auto-index parameter for float types has been updated to reflect this preference for hybrid indexing.

Highlights

  • Default High-Cardinality Index Selection: The default index selection for high-cardinality scalar fields in HybridScalarIndex has been changed from INVERTED to STLSORT for both primitive (non-integral) and string data types.
  • Float Type Auto-Index Parameter: The default auto-index build parameter for float fields in the system configuration has been updated from INVERTED to HYBRID.

🧠 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.

@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Jan 15, 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.

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 enhances the hybrid scalar index by changing the default index type for high-cardinality fields from INVERTED to STLSORT. This change affects both numeric types like float and std::string. The modifications in internal/core/src/index/HybridScalarIndex.cpp correctly implement this logic, and the default auto-index parameters in pkg/util/paramtable/autoindex_param.go are updated for float types to leverage this new HYBRID index behavior. The changes appear correct and align with the goal of improving performance. I have one suggestion to refactor some duplicated code to improve maintainability.

Comment on lines 59 to 63
if (distinct_vals.size() >= bitmap_index_cardinality_limit_) {
if constexpr (std::is_integral_v<T>) {
internal_index_type_ = ScalarIndexType::STLSORT;
} else {
internal_index_type_ = ScalarIndexType::INVERTED;
}
internal_index_type_ = ScalarIndexType::STLSORT;
} else {
internal_index_type_ = ScalarIndexType::BITMAP;
}

Choose a reason for hiding this comment

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

medium

This logic for choosing the index type based on cardinality is now duplicated in four places within this file:

  • HybridScalarIndex<T>::SelectIndexBuildType (here, lines 59-63)
  • HybridScalarIndex<std::string>::SelectIndexBuildType (lines 80-84)
  • HybridScalarIndex<T>::SelectBuildTypeForPrimitiveType (lines 105-109)
  • HybridScalarIndex<std::string>::SelectBuildTypeForPrimitiveType (lines 130-134)

To improve maintainability and reduce code duplication, consider extracting this logic into a private helper function. For example:

private:
    void
    ChooseIndexTypeByCardinality(size_t cardinality) {
        if (cardinality >= bitmap_index_cardinality_limit_) {
            internal_index_type_ = ScalarIndexType::STLSORT;
        } else {
            internal_index_type_ = ScalarIndexType::BITMAP;
        }
    }

You could then replace the duplicated blocks with a call to this new helper function, like ChooseIndexTypeByCardinality(distinct_vals.size());.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logic is intentionally kept inline because:

  1. It's only 4 lines of simple if-else
  2. These are template specializations that may diverge in the future
  3. Extracting such trivial logic may reduce readability without significant maintainability benefit

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.44%. Comparing base (9373518) to head (2b9de53).
⚠️ Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
internal/core/src/index/HybridScalarIndex.cpp 71.42% 2 Missing ⚠️
...ernal/util/indexparamcheck/hybrid_index_checker.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #47084      +/-   ##
==========================================
- Coverage   76.46%   76.44%   -0.02%     
==========================================
  Files        2016     2016              
  Lines      325600   326297     +697     
==========================================
+ Hits       248972   249442     +470     
- Misses      68670    68862     +192     
- Partials     7958     7993      +35     
Components Coverage Δ
Client 75.68% <ø> (ø)
Core 83.01% <98.97%> (+0.12%) ⬆️
Go 74.75% <57.99%> (-0.08%) ⬇️
Files with missing lines Coverage Δ
pkg/util/paramtable/autoindex_param.go 82.40% <100.00%> (ø)
internal/core/src/index/HybridScalarIndex.cpp 79.78% <71.42%> (+1.20%) ⬆️
...ernal/util/indexparamcheck/hybrid_index_checker.go 88.00% <60.00%> (-12.00%) ⬇️

... and 46 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify
Copy link
Contributor

mergify bot commented Jan 15, 2026

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

Signed-off-by: Buqian Zheng <[email protected]>
@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhengbuqian

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

The pull request process is described 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

@mergify mergify bot added the ci-passed label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved area/test ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement sig/testing size/M Denotes a PR that changes 30-99 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants