-
Couldn't load subscription status.
- Fork 118
Define an ExpressionTransform trait #530
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
Conversation
| pub left: Box<Expression>, | ||
| /// The right-hand side of the operation. | ||
| pub right: Box<Expression>, |
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.
NOTE: While it would be tempting to do Box<BinaryExpression> instead of two boxes here, that would prevent match arms from unpacking it. So we keep the boxes inside the struct, and out of the way.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #530 +/- ##
==========================================
- Coverage 80.76% 80.61% -0.15%
==========================================
Files 67 67
Lines 14076 14278 +202
Branches 14076 14278 +202
==========================================
+ Hits 11368 11510 +142
- Misses 2134 2188 +54
- Partials 574 580 +6 ☔ View full report in Codecov by Sentry. |
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.
lgtm!
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.
LGTM just left a quick question and perhaps we want to consider moving much of the new transform code to a new module?
| depth_limit: usize, | ||
| max_depth_seen: usize, | ||
| current_depth: usize, | ||
| call_count: usize, |
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.
out of curiosity, why usize instead of u64 etc.? I always associate usize as the type for indexing into memory, and feel like I would have just defaulted to u64 here (or even something smaller)?
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.
Not sure about rust, but in c++ size_t (usize equivalent) is the general purpose count/size type.
For example, Iterator::count returns usize.
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.
thanks!
What changes are proposed in this pull request?
Similar to the existing
SchemaTransformtrait, anExpressionTransformtrait can make it a lot easier to recursively manipulate expressions. Define the trait and introduce an expression depth checker to test it.This PR affects the following public APIs
Because enum tuple variants cannot be passed as function arguments, we factor out
UnaryExpression,BinaryExpressionandVariadicExpressionstructs which the corresponding expression variants can then use. This requires updating match arms throughout the code base.How was this change tested?
New unit test.