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

Minor: Introduce Expr::is_volatile(), adjust TreeNode::exists() #10191

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

peter-toth
Copy link
Contributor

@peter-toth peter-toth commented Apr 23, 2024

This PR introduces Expr::is_volatile() instead of is_volatile_expression(e: &Expr).
Also, a small change is needed to TreeNode::exists(), that it is a fairly new API, and the change makes it more versatile.

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules labels Apr 23, 2024
@peter-toth peter-toth changed the title Introduce Expr::is_volatile(), adjust TreeNode::exists() Minor: Introduce Expr::is_volatile(), adjust TreeNode::exists() Apr 23, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks like a very nice improvement to me -- thank you @peter-toth

@@ -405,18 +405,17 @@ pub trait TreeNode: Sized {
/// Returns true if `f` returns true for any node in the tree.
///
/// Stops recursion as soon as a matching node is found
fn exists<F: FnMut(&Self) -> bool>(&self, mut f: F) -> bool {
fn exists<F: FnMut(&Self) -> Result<bool>>(&self, mut f: F) -> Result<bool> {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -97,20 +95,6 @@ pub fn log_plan(description: &str, plan: &LogicalPlan) {
trace!("{description}::\n{}\n", plan.display_indent_schema());
}

/// check whether the expression is volatile predicates
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@alamb alamb merged commit 15045a8 into apache:main Apr 23, 2024
25 checks passed
@peter-toth
Copy link
Contributor Author

Thanks for the review!

ccciudatu pushed a commit to hstack/arrow-datafusion that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants