-
Notifications
You must be signed in to change notification settings - Fork 89
[rust] Procedural macros for Tup generation #5323
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces procedural macros for tuple generation and adds an IsNone trait for future null optimization. It replaces the macro-based tuple declaration system with a procedural macro approach and removes unused example/benchmark code.
- Adds
feldera-macroscrate withdeclare_tuple!macro andIsNonederive macro - Migrates tuple generation from declarative macros to procedural macros
- Removes unused GDELT benchmarks and JSON example code
Reviewed changes
Copilot reviewed 55 out of 59 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/feldera-macros/* | New crate providing procedural macros for tuple generation and IsNone trait |
| crates/dbsp/src/utils/tuple/gen.rs | Removed old declarative macro implementation |
| crates/dbsp/src/utils/tuple.rs | Updated to use new procedural macros |
| crates/dbsp/src/utils/is_none.rs | New trait and implementations for null optimization |
| crates/dbsp/src/trace.rs | Added IsNone bound to DBData trait |
| sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/compiler/backend/rust/*.java | Updated Java code generators to use new macro syntax |
| crates/dbsp/examples/json.rs | Removed unused JSON example |
| crates/dbsp/benches/gdelt/* | Removed unused GDELT benchmarks |
| Various test and example files | Added IsNone derive to struct definitions |
d3a4243 to
d2301f9
Compare
d2301f9 to
e017654
Compare
e017654 to
11e82fa
Compare
11e82fa to
b4751f6
Compare
b4751f6 to
7d1bc0a
Compare
7d1bc0a to
5744281
Compare
ca7a6b7 to
3e3c091
Compare
|
Let me know when this is ready for review, I still see a lot of churn |
|
it is ready |
618b224 to
aad3b1f
Compare
| serde_json = { workspace = true } | ||
| ptr_meta = { workspace = true } | ||
| feldera-types = { workspace = true } | ||
| feldera-macros = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove examples and benchmarks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed gdelt because no one has touched it in years
removed ijson because we never ended up using it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact no one has touched it may be a sign that it needs to be kept; check with Leonid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryzhyk can comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok for it to go
| if std::env::var_os("FELDERA_DEV_MACROS_DUMP").is_some() { | ||
| let parsed_file: syn::File = syn::parse2(expanded.clone()).expect("Failed to parse output"); | ||
| let formatted = prettyplease::unparse(&parsed_file); | ||
| eprintln!("{}", formatted); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
| expanded | ||
| } | ||
|
|
||
| pub(super) struct TupleDef { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
putting this first would make the code easier to review
| .into_iter() | ||
| .filter_map(|param| { | ||
| if let syn::GenericParam::Type(ty) = param { | ||
| Some(ty.ident) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why Some(...) has a type of Punctuated<>.
Also add IsNone trait for future null optimization. Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
aad3b1f to
37130ab
Compare
ryzhyk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't yet know how to read procedural macros, so didn't review that part. I wonder if IsNone is sufficient for the upcoming rkyv optimization. Don't we also need to IsOption to determine if the type is an option and needs a bit in the bitmap?
| serde_json = { workspace = true } | ||
| ptr_meta = { workspace = true } | ||
| feldera-types = { workspace = true } | ||
| feldera-macros = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok for it to go
Also add IsNone trait for future null optimization.
Remove some unused/old example benchmark code.