-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Introduce ExprVolatility to model constant expressions #19188
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
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` |
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.
| /// ``` | |
| /// ```rust |
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` |
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.
| /// ``` | |
| /// ```rust |
| matches!( | ||
| expr.volatility(), | ||
| ExprVolatility::Constant | ExprVolatility::Stable | ||
| ) |
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 love this, it's a bit confusing. I wonder if the right distinction is Stable with no inputs (e.g. now()?
|
|
||
| pub is_volatile_node: unsafe extern "C" fn(&Self) -> bool, | ||
|
|
||
| pub node_volatility: unsafe extern "C" fn(&Self) -> FFI_ExprVolatility, |
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.
This looks reasonable but is my first time doing FFI work in DataFusion
| fn node_volatility(&self) -> ExprVolatility { | ||
| // Although DynamicFilterPhysicalExpr can change its inner expression, | ||
| // from the perspective of optimizer rules it can be treated as immutable | ||
| // so that it can be pushed down, etc. | ||
| ExprVolatility::Immutable | ||
| } |
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.
This is unfortunate, but I'm not sure how else to model this?
|
I got this mostly working but I'm not sure it's the right path forward and don't have the bandwith to work on it so I'll close as an idea and continue discussion in the issue. |
Closes #19187
This PR was seeded by giving Claude the plan in the linked issue and guidance/supervision.