-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove any aliases in Filter::try_new
rather than erroring
#11307
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ use std::sync::Arc; | |
use super::dml::CopyTo; | ||
use super::DdlStatement; | ||
use crate::builder::{change_redundant_column, unnest_with_options}; | ||
use crate::expr::{Alias, Placeholder, Sort as SortExpr, WindowFunction}; | ||
use crate::expr::{Placeholder, Sort as SortExpr, WindowFunction}; | ||
use crate::expr_rewriter::{create_col_from_scalar_expr, normalize_cols}; | ||
use crate::logical_plan::display::{GraphvizVisitor, IndentVisitor}; | ||
use crate::logical_plan::extension::UserDefinedLogicalNode; | ||
|
@@ -2130,16 +2130,10 @@ impl Filter { | |
} | ||
} | ||
|
||
// filter predicates should not be aliased | ||
if let Expr::Alias(Alias { expr, name, .. }) = predicate { | ||
return plan_err!( | ||
"Attempted to create Filter predicate with \ | ||
expression `{expr}` aliased as '{name}'. Filter predicates should not be \ | ||
aliased." | ||
); | ||
} | ||
|
||
Ok(Self { predicate, input }) | ||
Ok(Self { | ||
predicate: predicate.unalias_nested().data, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thought is to execute But the current implementation is also acceptable to me. Thank you @samuelcolvin . If we follow the current implementation, we also need to remove the redundant cc @alamb There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed #11339 to track There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR to fix: #11340 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unaliasing rather than throwing an exception here makes sense to me. |
||
input, | ||
}) | ||
} | ||
|
||
/// Is this filter guaranteed to return 0 or 1 row in a given instantiation? | ||
|
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 am confused about this check; it is not aligned with
unalias_nested
.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 think it is a very old check and substantially predates
unalias_nested
so it may have become unaligned over time