Skip to content

fix(datacell): restore total_count_ during deserialization#1621

Merged
inabao merged 2 commits intomainfrom
fix-sparse-term-datacell-total-count
Mar 4, 2026
Merged

fix(datacell): restore total_count_ during deserialization#1621
inabao merged 2 commits intomainfrom
fix-sparse-term-datacell-total-count

Conversation

@inabao
Copy link
Copy Markdown
Collaborator

@inabao inabao commented Mar 3, 2026

clsoe: #1622

  • Add logic in SparseTermDataCell::Deserialize to restore total_count_ from deserialized data

  • Avoid serializing total_count_ to maintain backward compatibility

  • Add use_term_lists_heap_insert parameter test in SINDI Serialize File test

inabao and others added 2 commits March 3, 2026 21:42
…rialization

- Add logic in SparseTermDataCell::Deserialize to restore total_count_ from deserialized data

- Avoid serializing total_count_ to maintain backward compatibility

- Add use_term_lists_heap_insert parameter test in SINDI Serialize File test

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 addresses a potential data inconsistency issue where the total_count_ in SparseTermDataCell was not being correctly restored after deserialization. The solution involves recomputing this count from the available term IDs, thereby ensuring data accuracy without altering the serialization format for backward compatibility. Additionally, new test cases have been introduced to validate serialization and deserialization processes with a specific search parameter, enhancing the robustness of the system.

Highlights

  • DataCell Deserialization: Added logic within SparseTermDataCell::Deserialize to correctly restore the total_count_ member variable. This ensures data integrity after deserialization.
  • Backward Compatibility: The total_count_ field is no longer serialized to maintain backward compatibility with existing data formats, as its value is now recomputed upon deserialization.
  • Test Coverage: Expanded test coverage in SINDI Serialize File tests to include the use_term_lists_heap_insert parameter, ensuring proper serialization and deserialization behavior under various configurations.

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

Changelog
  • src/datacell/sparse_term_datacell.cpp
    • Added logic to recompute and restore total_count_ during the Deserialize method, ensuring its value is correct after loading data.
  • tests/test_sindi.cpp
    • Introduced a new static helper method GenerateSearchParameter to create JSON search parameter strings, including the use_term_lists_heap_insert option.
    • Updated calls to TestSerializeBinarySet, TestSerializeReaderSet, and TestSerializeFile to utilize the newly generated search parameters, adding test coverage for use_term_lists_heap_insert.
Activity
  • No human activity has been recorded on this pull request yet.
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.

Copy link
Copy Markdown
Contributor

@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 addresses an issue in SparseTermDataCell::Deserialize by adding logic to restore the total_count_ member variable. This is done by iterating over the deserialized term_ids_ to ensure data consistency after loading, while not modifying the serialized format to preserve backward compatibility. The changes also include an update to the SINDI Serialize File test to cover different values for the use_term_lists_heap_insert search parameter. The changes are correct and address the issue described.

Copy link
Copy Markdown
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main    #1621      +/-   ##
==========================================
+ Coverage   90.68%   90.83%   +0.15%     
==========================================
  Files         329      329              
  Lines       19487    19492       +5     
==========================================
+ Hits        17672    17706      +34     
+ Misses       1815     1786      -29     
Flag Coverage Δ
cpp 90.83% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 85.81% <ø> (ø)
datacell 92.26% <ø> (+1.58%) ⬆️
index 90.28% <ø> (-0.21%) ⬇️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bea8f9...d87c5cd. Read the comment docs.

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

Copy link
Copy Markdown
Collaborator

@wxyucs wxyucs left a comment

Choose a reason for hiding this comment

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

lgtm

@inabao inabao merged commit b97835e into main Mar 4, 2026
38 of 40 checks passed
@inabao inabao deleted the fix-sparse-term-datacell-total-count branch March 4, 2026 08:17
wxyucs pushed a commit that referenced this pull request Mar 5, 2026
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Co-authored-by: Claude <noreply@anthropic.com>
@wxyucs
Copy link
Copy Markdown
Collaborator

wxyucs commented Mar 16, 2026

@inabao this pull request cannot cherry-pick to the branch 0.16 (CONFLICTS), please create a new pull request to the branch 0.16 .

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants