Skip to content

Remove expand wildcard rule #15170

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

Merged
merged 14 commits into from
Mar 12, 2025
11 changes: 5 additions & 6 deletions datafusion/core/src/datasource/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use datafusion_catalog::Session;
use datafusion_common::config::ConfigOptions;
use datafusion_common::Column;
use datafusion_expr::{LogicalPlanBuilder, TableProviderFilterPushDown};
use datafusion_optimizer::analyzer::expand_wildcard_rule::ExpandWildcardRule;
use datafusion_optimizer::analyzer::type_coercion::TypeCoercion;
use datafusion_optimizer::Analyzer;

Expand Down Expand Up @@ -68,11 +67,11 @@ impl ViewTable {

fn apply_required_rule(logical_plan: LogicalPlan) -> Result<LogicalPlan> {
let options = ConfigOptions::default();
Analyzer::with_rules(vec![
Arc::new(ExpandWildcardRule::new()),
Arc::new(TypeCoercion::new()),
])
.execute_and_check(logical_plan, &options, |_, _| {})
Analyzer::with_rules(vec![Arc::new(TypeCoercion::new())]).execute_and_check(
logical_plan,
&options,
|_, _| {},
)
}

/// Get definition ref
Expand Down
333 changes: 0 additions & 333 deletions datafusion/optimizer/src/analyzer/expand_wildcard_rule.rs

This file was deleted.

8 changes: 5 additions & 3 deletions datafusion/optimizer/src/analyzer/inline_table_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ use crate::analyzer::AnalyzerRule;
use datafusion_common::config::ConfigOptions;
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
use datafusion_common::{Column, Result};
use datafusion_expr::{logical_plan::LogicalPlan, wildcard, Expr, LogicalPlanBuilder};
use datafusion_expr::utils::expand_wildcard;
use datafusion_expr::{logical_plan::LogicalPlan, Expr, LogicalPlanBuilder};

/// Analyzed rule that inlines TableScan that provide a [`LogicalPlan`]
/// (DataFrame / ViewTable)
Expand Down Expand Up @@ -92,7 +93,8 @@ fn generate_projection_expr(
)));
}
} else {
exprs.push(wildcard());
let expanded = expand_wildcard(sub_plan.schema(), sub_plan, None)?;
exprs.extend(expanded);
}
Ok(exprs)
}
Expand Down Expand Up @@ -181,7 +183,7 @@ mod tests {
let plan = scan.filter(col("x.a").eq(lit(1)))?.build()?;
let expected = "Filter: x.a = Int32(1)\
\n SubqueryAlias: x\
\n Projection: *\
\n Projection: y.a, y.b\
\n TableScan: y";

assert_analyzed_plan_eq(Arc::new(InlineTableScan::new()), plan, expected)
Expand Down
Loading