Skip to content

Conversation

@adriangb
Copy link
Contributor

@adriangb adriangb commented Dec 7, 2025

Closes #19187

This PR was seeded by giving Claude the plan in the linked issue and guidance/supervision.

@github-actions github-actions bot added documentation Improvements or additions to documentation logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates optimizer Optimizer rules substrait Changes to the substrait crate proto Related to proto crate ffi Changes to the ffi crate physical-plan Changes to the physical-plan crate labels Dec 7, 2025
///
/// # Examples
///
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// ```
/// ```rust

///
/// # Examples
///
/// ```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// ```
/// ```rust

Comment on lines +104 to +107
matches!(
expr.volatility(),
ExprVolatility::Constant | ExprVolatility::Stable
)
Copy link
Contributor Author

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,
Copy link
Contributor Author

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

Comment on lines +419 to +424
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
}
Copy link
Contributor Author

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?

@adriangb
Copy link
Contributor Author

adriangb commented Dec 8, 2025

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.

@adriangb adriangb closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ffi Changes to the ffi crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate proto Related to proto crate substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce the concept of expression volatility

1 participant