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

[BUG] Fix pushdown past monotonically increasing id #2622

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ impl PushDownProjection {
| LogicalPlan::Limit(..)
| LogicalPlan::Filter(..)
| LogicalPlan::Sample(..)
| LogicalPlan::MonotonicallyIncreasingId(..)
| LogicalPlan::Explode(..)
| LogicalPlan::Unpivot(..) => {
// Get required columns from projection and upstream.
Expand Down Expand Up @@ -435,8 +434,8 @@ impl PushDownProjection {
// since Distinct implicitly requires all parent columns.
Ok(Transformed::No(plan))
}
LogicalPlan::Pivot(_) => {
// Cannot push down past a Pivot because it changes the schema.
LogicalPlan::Pivot(_) | LogicalPlan::MonotonicallyIncreasingId(_) => {
// Cannot push down past a Pivot/MonotonicallyIncreasingId because it changes the schema.
Ok(Transformed::No(plan))
}
LogicalPlan::Sink(_) => {
Expand Down Expand Up @@ -800,4 +799,20 @@ mod tests {

Ok(())
}

/// Projection does not push down past monotonically increasing id
#[test]
fn test_projection_no_pushdown_monotonically_increasing_id() -> DaftResult<()> {
let scan_op = dummy_scan_operator(vec![
Field::new("a", DataType::Int64),
Field::new("b", DataType::Int64),
]);
let plan = dummy_scan_node(scan_op.clone())
.add_monotonically_increasing_id(Some("id"))?
.select(vec![col("id")])?
.build();
let expected = plan.clone();
assert_optimized_plan_eq(plan, expected)?;
Ok(())
}
}
Loading