Skip to content

Commit d97960f

Browse files
authored
Remove expand wildcard rule (#15170)
* first draft * fix tests * cleanup * assert * clippy * fix test * fix test * Refactor wildcard expansion in InlineTableScan and update related tests * rm rule * Remove ExpandWildcardRule from Analyzer in ViewTable * fix * clippy
1 parent efb75f3 commit d97960f

File tree

6 files changed

+11
-356
lines changed

6 files changed

+11
-356
lines changed

datafusion/core/src/datasource/view.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use datafusion_catalog::Session;
3030
use datafusion_common::config::ConfigOptions;
3131
use datafusion_common::Column;
3232
use datafusion_expr::{LogicalPlanBuilder, TableProviderFilterPushDown};
33-
use datafusion_optimizer::analyzer::expand_wildcard_rule::ExpandWildcardRule;
3433
use datafusion_optimizer::analyzer::type_coercion::TypeCoercion;
3534
use datafusion_optimizer::Analyzer;
3635

@@ -68,11 +67,11 @@ impl ViewTable {
6867

6968
fn apply_required_rule(logical_plan: LogicalPlan) -> Result<LogicalPlan> {
7069
let options = ConfigOptions::default();
71-
Analyzer::with_rules(vec![
72-
Arc::new(ExpandWildcardRule::new()),
73-
Arc::new(TypeCoercion::new()),
74-
])
75-
.execute_and_check(logical_plan, &options, |_, _| {})
70+
Analyzer::with_rules(vec![Arc::new(TypeCoercion::new())]).execute_and_check(
71+
logical_plan,
72+
&options,
73+
|_, _| {},
74+
)
7675
}
7776

7877
/// Get definition ref

datafusion/optimizer/src/analyzer/expand_wildcard_rule.rs

Lines changed: 0 additions & 333 deletions
This file was deleted.

datafusion/optimizer/src/analyzer/inline_table_scan.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ use crate::analyzer::AnalyzerRule;
2323
use datafusion_common::config::ConfigOptions;
2424
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
2525
use datafusion_common::{Column, Result};
26-
use datafusion_expr::{logical_plan::LogicalPlan, wildcard, Expr, LogicalPlanBuilder};
26+
use datafusion_expr::utils::expand_wildcard;
27+
use datafusion_expr::{logical_plan::LogicalPlan, Expr, LogicalPlanBuilder};
2728

2829
/// Analyzed rule that inlines TableScan that provide a [`LogicalPlan`]
2930
/// (DataFrame / ViewTable)
@@ -92,7 +93,8 @@ fn generate_projection_expr(
9293
)));
9394
}
9495
} else {
95-
exprs.push(wildcard());
96+
let expanded = expand_wildcard(sub_plan.schema(), sub_plan, None)?;
97+
exprs.extend(expanded);
9698
}
9799
Ok(exprs)
98100
}
@@ -181,7 +183,7 @@ mod tests {
181183
let plan = scan.filter(col("x.a").eq(lit(1)))?.build()?;
182184
let expected = "Filter: x.a = Int32(1)\
183185
\n SubqueryAlias: x\
184-
\n Projection: *\
186+
\n Projection: y.a, y.b\
185187
\n TableScan: y";
186188

187189
assert_analyzed_plan_eq(Arc::new(InlineTableScan::new()), plan, expected)

0 commit comments

Comments
 (0)