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

Remove query! macro. #236

Closed
3 tasks
JayWhite2357 opened this issue Oct 7, 2024 · 9 comments · Fixed by #284
Closed
3 tasks

Remove query! macro. #236

JayWhite2357 opened this issue Oct 7, 2024 · 9 comments · Fixed by #284
Labels
💎 Bounty good first issue Good for newcomers refactor Code cleanup or reorganization released 💰 Rewarded

Comments

@JayWhite2357
Copy link
Contributor

JayWhite2357 commented Oct 7, 2024

Background and Motivation

Rust macros are a bit of a anti-pattern. In particular, the query! macro, which is used as a testing utility macro to test QueryExpr, obfuscates the tests.

Changes Required

  • Remove uses of the query! macro and replace it with explicit uses of the tested methods. For example,
    let query = query!(
    select: ["max(i) max_sal", "i0 d", "count(i0)"],
    group: ["i0", "i1"],
    order: ["max_sal"]
    );
    can be replaced by
    let query_text = "select max(i) max_sal, i0 d, count(i0) from t group by i0, i1 order by max_sal";
    let (t, accessor) = get_test_accessor();
    let intermediate_ast = SelectStatementParser::new().parse(query_text).unwrap();
    let query = QueryExpr::<NaiveCommitment>::try_new(intermediate_ast, t.schema_id(), &accessor).unwrap();
  • Refactor or remove get_test_accessor so that it is explicit what the tables, columns, and data types are in the SchemaAccessor. For example, the above query has a t table with the columns i, i0, and i1, all with BigInt type. These columns should also be renamed to be slightly less generic and/or more helpful.
  • Remove the query! macro.

NOTE: the macro is almost exclusively a macro that builds the query text. The actual functionality being tested should be essentially unchanged.

@JayWhite2357 JayWhite2357 added enhancement New feature or request refactor Code cleanup or reorganization good first issue Good for newcomers and removed enhancement New feature or request labels Oct 8, 2024
@JayWhite2357
Copy link
Contributor Author

/bounty $50

Copy link

algora-pbc bot commented Oct 9, 2024

💎 $50 bounty • Space and Time

Steps to solve:

  1. Start working: (Optional) Comment /attempt #236 with your implementation plan. Note: we will only assign an issue if you include an implementation plan with a time estimate. Additionally, to be assigned an issue, you must have previously contributed to the project. You can still work on an issue and submit a PR without being assigned.
  2. Submit work: Create a pull request including /claim #236 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 spaceandtimelabs/sxt-proof-of-sql!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @Harsh9485 Oct 15, 2024, 10:33:45 AM WIP
🟢 @akhilender-bongirwar Nov 1, 2024, 3:42:19 AM #284

@Harsh9485
Copy link

Harsh9485 commented Oct 15, 2024

/attempt #236

Copy link

algora-pbc bot commented Oct 20, 2024

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

Copy link

🎉 This issue has been resolved in version 0.34.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@akhilender-bongirwar
Copy link
Contributor

@JayWhite2357 I did not receive the bounty. I think you need to approve it on the Algora dashboard.

@akhilender-bongirwar
Copy link
Contributor

@JayWhite2357 I did not receive the bounty. I think you need to approve it on the Algora dashboard.

// @iajoiner

@akhilender-bongirwar
Copy link
Contributor

akhilender-bongirwar commented Nov 1, 2024

/attempt #236

Maybe I didn't do this before that might be reason I was not awarded the bounty but it is written optional in the guidelines.

Algora profile Completed bounties Tech Active attempts Options
@akhilender-bongirwar 5 bounties from 4 projects
TypeScript, JavaScript,
C++ & more
Cancel attempt

Copy link

algora-pbc bot commented Nov 4, 2024

🎉🎈 @akhilender-bongirwar has been awarded $50! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty good first issue Good for newcomers refactor Code cleanup or reorganization released 💰 Rewarded
Projects
None yet
3 participants