Skip to content

[MOD-9999] Migrate RSAggregateResult to Rust#6255

Merged
chesedo merged 13 commits intomasterfrom
migrate_rs_aggregate_result_to_rust
Jun 11, 2025
Merged

[MOD-9999] Migrate RSAggregateResult to Rust#6255
chesedo merged 13 commits intomasterfrom
migrate_rs_aggregate_result_to_rust

Conversation

@chesedo
Copy link
Collaborator

@chesedo chesedo commented Jun 4, 2025

Describe the changes in the pull request

This moves the RSAggregateResult definition to Rust in preparation of moving the RSIndexResult to Rust too. This will make it easier to port the inverted index to Rust.

The Rust definition is exactly the same as the old C definition, so nothing in the C code needs to be updated.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@chesedo chesedo requested a review from LukeMathWalker June 4, 2025 13:36
@github-actions github-actions bot added the size:S label Jun 4, 2025
@chesedo chesedo requested a review from LukeMathWalker June 4, 2025 15:01
Comment on lines 23 to 38
pub num_children: c_int,

/// The capacity of the records array. Has no use for extensions
pub children_cap: c_int,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to keep it as a c_int? Considering what we are tracking, I would assume that a u16 would do just fine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would say yes for the time being. We need the C output to be int (to match the old declaration) since it can be 16 or 32 bits depending on the compiling machine. Using i16 / u16 could therefore change the alignment

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know that it would be a change—my argument here is that it should not be an int in C either. I'm also OK with doing the change in another PR if we want to keep this a pure refactoring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see. Let me make another PR to change the C to always be a u16. Would like to keep this one focused on the refactor

@chesedo chesedo force-pushed the migrate_rs_numeric_record_to_rust branch from 7a51007 to 4ed89e4 Compare June 5, 2025 06:41
@chesedo chesedo force-pushed the migrate_rs_aggregate_result_to_rust branch from 13009f3 to dffd860 Compare June 5, 2025 08:31
@github-actions github-actions bot added the size:M label Jun 5, 2025
@chesedo chesedo force-pushed the migrate_rs_numeric_record_to_rust branch 2 times, most recently from ccbe1e1 to c6ececc Compare June 9, 2025 07:06
Base automatically changed from migrate_rs_numeric_record_to_rust to master June 9, 2025 14:40
@chesedo chesedo force-pushed the migrate_rs_aggregate_result_to_rust branch from 3a698a9 to ceb3eef Compare June 10, 2025 10:53
chesedo added 11 commits June 10, 2025 17:10
This is needed to move `RSIndexResult` to Rust which will make it easier
to port the inverted index to Rust.
This just makes the C compiler happy when "reading" values of the vector.
This will makes the usages of `RSAggregateResult` more correct inside
the Rust code.
The latest code has a fix we need for the Rust code to compile. But it
is not released yet so just using it directly for now.
@chesedo chesedo force-pushed the migrate_rs_aggregate_result_to_rust branch from d97568e to 6e6a1a4 Compare June 10, 2025 15:32
zeenix
zeenix previously approved these changes Jun 10, 2025
Copy link
Contributor

@zeenix zeenix left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

@chesedo chesedo marked this pull request as ready for review June 10, 2025 15:50
@chesedo chesedo requested a review from alonre24 June 10, 2025 15:50
Comment on lines +136 to +140
* ```ignore
* struct BitFlags<T, N = <T as BitFlag>::Numeric> {
* value: N,
* marker: PhantomData<T>,
* }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This practice is not needed for us in RSResultTypeMask?

Copy link
Contributor

Choose a reason for hiding this comment

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

@alonre24 this is generated code from Rust and these docs are verbatim copied by the cbindgen tool. @chesedo and I agreed last evening that it'd be great to disable this copying and he'll look into that today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we probably won't use any const functions. Note that this documentation comes from the enumflags2 crate via its BitFlags type.

It's coming from this line

pub type RSResultTypeMask = BitFlags<RSResultType, u32>;

Copy link
Collaborator Author

@chesedo chesedo Jun 11, 2025

Choose a reason for hiding this comment

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

Turning it off is also a no go. cbindgen only allows turning all documentation off and not the documentation of a single type.

@chesedo chesedo force-pushed the migrate_rs_aggregate_result_to_rust branch from e04cf6b to 0dadce0 Compare June 11, 2025 08:41
@chesedo chesedo requested a review from alonre24 June 11, 2025 09:20
alonre24
alonre24 previously approved these changes Jun 11, 2025
@chesedo chesedo enabled auto-merge June 11, 2025 11:34
@LukeMathWalker LukeMathWalker disabled auto-merge June 11, 2025 11:35
This is needed to make the doc tests pass since the FFI is going to pull
in a comment which shows how to use `BitFlags`.
@codecov
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.82%. Comparing base (a652b01) to head (7b07b3c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6255      +/-   ##
==========================================
- Coverage   88.89%   88.82%   -0.07%     
==========================================
  Files         240      240              
  Lines       40524    40524              
  Branches     3165     3165              
==========================================
- Hits        36023    35995      -28     
- Misses       4466     4494      +28     
  Partials       35       35              
Flag Coverage Δ
flow 82.17% <ø> (-0.18%) ⬇️
unit 46.03% <ø> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@chesedo chesedo disabled auto-merge June 11, 2025 13:15
@chesedo chesedo enabled auto-merge June 11, 2025 13:15
@chesedo chesedo added this pull request to the merge queue Jun 11, 2025
Merged via the queue into master with commit 5291f97 Jun 11, 2025
14 checks passed
@chesedo chesedo deleted the migrate_rs_aggregate_result_to_rust branch June 11, 2025 14:26
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.

4 participants