Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace macro with just code for structure builders #195

Closed
generall opened this issue Nov 18, 2024 · 8 comments
Closed

Replace macro with just code for structure builders #195

generall opened this issue Nov 18, 2024 · 8 comments

Comments

@generall
Copy link
Member

Currently we use macro definitions to auto-generate code for structure builders, which looks like this:

builder_type_conversions!(CreateCollection, CreateCollectionBuilder);
builder_type_conversions!(VectorParams, VectorParamsBuilder, true);
builder_type_conversions!(HnswConfigDiff, HnswConfigDiffBuilder);
builder_type_conversions!(ScalarQuantization, ScalarQuantizationBuilder, true);
builder_type_conversions!(ProductQuantization, ProductQuantizationBuilder, true);
builder_type_conversions!(BinaryQuantization, BinaryQuantizationBuilder, true);
builder_type_conversions!(OptimizersConfigDiff, OptimizersConfigDiffBuilder);

https://github.com/qdrant/rust-client/blob/master/src/qdrant.rs#L9606

But usage of macros makes navigation in the project harder.

qdrant.rs file is generated using code from here https://github.com/qdrant/rust-client/blob/master/tests/protos.rs#L173 (yes, in test 🤷‍♂️ )

I propose to abandon macros and use hand-written code instead. It would be easier to write a whole new definition of the builder than to understand how generator works.

To do this, I think we need to

  • generate the code by unrolling existing macroses
  • Copy builders-related generated code into new files
  • remove all macro generations and rely only on the copy-pasted code.

In order to make sure friction-less transition, we need to make sure all test snippets are still valid without changing: https://github.com/qdrant/rust-client/tree/master/tests/snippet_tests

@generall
Copy link
Member Author

/bounty $200

Copy link

algora-pbc bot commented Nov 18, 2024

## 💎 $200 bounty • Qdrant

### Steps to solve:
1. Start working: Comment /attempt #195 with your implementation plan
2. Submit work: Create a pull request including /claim #195 in the PR body to claim the bounty
3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to qdrant/rust-client!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @Abiji-2020 Nov 19, 2024, 1:01:45 AM WIP
🔴 @vishwamartur Nov 19, 2024, 5:22:21 PM WIP
🟢 @palash25 Nov 20, 2024, 12:16:14 PM #199
🟢 @imperivox Nov 22, 2024, 3:30:55 PM WIP

@Abiji-2020
Copy link

Abiji-2020 commented Nov 19, 2024

/attempt #195

I am interested to work on this issue.

Algora profile Completed bounties Tech Active attempts Options
@Abiji-2020 3 bounties from 2 projects
C++, Java,
TypeScript & more
Cancel attempt

@vishwamartur
Copy link

vishwamartur commented Nov 19, 2024

/attempt #195

@palash25
Copy link
Contributor

palash25 commented Nov 20, 2024

/attempt #195

Algora profile Completed bounties Tech Active attempts Options
@palash25 1 bounty from 1 project
Go, Python,
Rust & more
Cancel attempt

@imperivox
Copy link

imperivox commented Nov 22, 2024

/attempt #195

palash25 added a commit to palash25/rust-client that referenced this issue Nov 24, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 24, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 24, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 25, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 25, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 25, 2024
palash25 added a commit to palash25/rust-client that referenced this issue Nov 25, 2024
Copy link

algora-pbc bot commented Nov 25, 2024

💡 @palash25 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Copy link

algora-pbc bot commented Nov 26, 2024

🎉🎈 @palash25 has been awarded $240! 🎈🎊

generall added a commit that referenced this issue Nov 26, 2024
* Replace macro generated builder types with unrolled ones

Fixes: #195

* fix clippy and implement missing defaults

* unexpose builder module and remove comment

---------

Co-authored-by: generall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants