Repository navigation
feat(scanner): allow filtering on projected columns - #11738
PenguinLoafs wants to merge 2 commits into
Conversation
| let filter_schema = | ||
| self.filterable_schema_with_fts_granularity(fts_document_granularity)?; | ||
| let planner = Planner::new(Arc::new(filter_schema.as_ref().into())); | ||
| let derived_columns = inlinable_derived_columns( |
There was a problem hiding this comment.
[AI-generated review] inlinable_derived_columns runs before checking self.filter.expr_filter, even though derived_columns is only used inside that branch. The default full projection contains one output per physical column, and Arrow’s Schema::field_with_name performs a linear search. An unfiltered scan of all 4,096 columns therefore adds 8,390,656 field-name comparisons during planning. Moving this call inside if let Some(filter) would let unfiltered scans skip that work, as get_expr_filter already does.
There was a problem hiding this comment.
The schema-sensitive alias failures are fixed. The reported wide-schema planning overhead remains a non-blocking risk for scans without filters. Computing alias candidates only when an expression filter exists would avoid that cost.
Summary
Filters cannot reference projection aliases because they are compiled against physical and system columns:
This PR resolves eligible aliases by inlining their definitions into the filter at compile time:
The existing execution order is preserved:
Closes #2971