-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: Allow nested is_in()
in when()/then()
for full-streaming
#20052
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ pub use scalar::is_scalar_ae; | |
use serde::{Deserialize, Serialize}; | ||
use strum_macros::IntoStaticStr; | ||
pub use traverse::*; | ||
pub(crate) use utils::permits_filter_pushdown; | ||
pub use utils::*; | ||
|
||
use crate::constants::LEN; | ||
|
@@ -218,35 +219,41 @@ impl AExpr { | |
pub(crate) fn col(name: PlSmallStr) -> Self { | ||
AExpr::Column(name) | ||
} | ||
/// Any expression that is sensitive to the number of elements in a group | ||
/// - Aggregations | ||
/// - Sorts | ||
/// - Counts | ||
/// - .. | ||
pub(crate) fn groups_sensitive(&self) -> bool { | ||
|
||
/// Checks whether this expression is elementwise. This only checks the top level expression. | ||
pub(crate) fn is_elementwise_top_level(&self) -> bool { | ||
use AExpr::*; | ||
|
||
match self { | ||
Function { options, .. } | AnonymousFunction { options, .. } => { | ||
options.is_groups_sensitive() | ||
} | ||
Sort { .. } | ||
| SortBy { .. } | ||
| Agg { .. } | ||
| Window { .. } | ||
AnonymousFunction { options, .. } => options.is_elementwise(), | ||
|
||
// Non-strict strptime must be done in-memory to ensure the format | ||
// is consistent across the entire dataframe. | ||
#[cfg(feature = "strings")] | ||
Function { | ||
options, | ||
function: FunctionExpr::StringExpr(StringFunction::Strptime(_, opts)), | ||
.. | ||
} => { | ||
assert!(options.is_elementwise()); | ||
opts.strict | ||
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. This rule was moved from new-streaming below |
||
}, | ||
|
||
Function { options, .. } => options.is_elementwise(), | ||
|
||
Literal(v) => v.projects_as_scalar(), | ||
|
||
Alias(_, _) | BinaryExpr { .. } | Column(_) | Ternary { .. } | Cast { .. } => true, | ||
|
||
Agg { .. } | ||
| Explode(_) | ||
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. Filter, gather, sort and explode don't seem elementwise. They are group sensitive but not elementwise. Maybe this is an unlucky name? |
||
| Filter { .. } | ||
| Gather { .. } | ||
| Len | ||
| Slice { .. } | ||
| Gather { .. } | ||
=> true, | ||
Alias(_, _) | ||
| Explode(_) | ||
| Column(_) | ||
| Literal(_) | ||
// a caller should traverse binary and ternary | ||
// to determine if the whole expr. is group sensitive | ||
| BinaryExpr { .. } | ||
| Ternary { .. } | ||
| Cast { .. } | ||
| Filter { .. } => false, | ||
| Sort { .. } | ||
| SortBy { .. } | ||
| Window { .. } => false, | ||
} | ||
} | ||
|
||
|
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.
is_elementwise_top_level()
replacesgroups_sensitive()
. It is also changed to considerExplode
andFilter
as non-elementwise