Skip to content

Commit 55fac97

Browse files
committed
include refine expr columns
1 parent 35f967a commit 55fac97

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

rust/lance/src/dataset/scanner.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,12 @@ impl Scanner {
29872987
.with_row_id()
29882988
.union_column(&q.column, OnMissing::Error)?;
29892989

2990+
// Include columns referenced by refine expression
2991+
if let Some(ref refine_expr) = filter_plan.refine_expr {
2992+
let refine_cols = Planner::column_names_in_expr(refine_expr);
2993+
scan_projection = scan_projection.union_columns(refine_cols, OnMissing::Error)?;
2994+
}
2995+
29902996
scan_projection.with_row_addr =
29912997
self.projection_plan.physical_projection.with_row_addr;
29922998

@@ -3003,16 +3009,7 @@ impl Scanner {
30033009

30043010
// Apply refine filter if present
30053011
let plan = if let Some(ref refine_expr) = filter_plan.refine_expr {
3006-
// Convert logical expression to physical expression
3007-
let schema = plan.schema();
3008-
let df_schema = DFSchema::try_from(schema.as_ref().clone())?;
3009-
let physical_expr =
3010-
create_physical_expr(refine_expr, &df_schema, &ExecutionProps::new())?;
3011-
3012-
Arc::new(datafusion::physical_plan::filter::FilterExec::try_new(
3013-
physical_expr,
3014-
plan,
3015-
)?)
3012+
Arc::new(LanceFilterExec::try_new(refine_expr.clone(), plan)?)
30163013
} else {
30173014
plan
30183015
};

0 commit comments

Comments
 (0)