Skip to content

Commit ede7bd3

Browse files
committed
Rolling back logical plan
1 parent 2ff0e9b commit ede7bd3

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

datafusion/expr/src/logical_plan/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ impl LogicalPlanBuilder {
342342
}
343343

344344
/// Apply a filter
345-
pub fn filter(self, expr: impl Into<Expr>, default_selectivity:u8) -> Result<Self> {
345+
pub fn filter(self, expr: impl Into<Expr>) -> Result<Self> {
346346
let expr = normalize_col(expr.into(), &self.plan)?;
347-
Filter::try_new(expr, Arc::new(self.plan), default_selectivity)
347+
Filter::try_new(expr, Arc::new(self.plan))
348348
.map(LogicalPlan::Filter)
349349
.map(Self::from)
350350
}
@@ -849,7 +849,7 @@ impl LogicalPlanBuilder {
849849
let join = Self::from(self.plan).cross_join(right)?;
850850
join.filter(filters.ok_or_else(|| {
851851
DataFusionError::Internal("filters should not be None here".to_string())
852-
})?, 20)
852+
})?)
853853
} else {
854854
Ok(Self::from(LogicalPlan::Join(Join {
855855
left: Arc::new(self.plan),

datafusion/expr/src/logical_plan/plan.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ impl LogicalPlan {
645645
.collect::<Vec<_>>(),
646646
}))
647647
}
648-
LogicalPlan::Filter(filter )=> {
648+
LogicalPlan::Filter { .. } => {
649649
assert_eq!(1, expr.len());
650650
let predicate = expr.pop().unwrap();
651651

@@ -687,7 +687,7 @@ impl LogicalPlan {
687687
let mut remove_aliases = RemoveAliases {};
688688
let predicate = predicate.rewrite(&mut remove_aliases)?;
689689

690-
Filter::try_new(predicate, Arc::new(inputs[0].clone()),filter.default_selectivity)
690+
Filter::try_new(predicate, Arc::new(inputs[0].clone()))
691691
.map(LogicalPlan::Filter)
692692
}
693693
LogicalPlan::Repartition(Repartition {
@@ -1887,13 +1887,11 @@ pub struct Filter {
18871887
pub predicate: Expr,
18881888
/// The incoming logical plan
18891889
pub input: Arc<LogicalPlan>,
1890-
// Selectivity
1891-
pub default_selectivity: u8,
18921890
}
18931891

18941892
impl Filter {
18951893
/// Create a new filter operator.
1896-
pub fn try_new(predicate: Expr, input: Arc<LogicalPlan>, default_selectivity: u8) -> Result<Self> {
1894+
pub fn try_new(predicate: Expr, input: Arc<LogicalPlan>) -> Result<Self> {
18971895
// Filter predicates must return a boolean value so we try and validate that here.
18981896
// Note that it is not always possible to resolve the predicate expression during plan
18991897
// construction (such as with correlated subqueries) so we make a best effort here and
@@ -1914,10 +1912,8 @@ impl Filter {
19141912
aliased."
19151913
);
19161914
}
1917-
if default_selectivity > 100 {
1918-
return plan_err!("Filter Selectivity must be between 0 and 100");
1919-
}
1920-
Ok(Self { predicate, input, default_selectivity })
1915+
1916+
Ok(Self { predicate, input })
19211917
}
19221918
}
19231919

0 commit comments

Comments
 (0)