MCPcopy Create free account
hub / github.com/apache/datafusion / create_relation

Method create_relation

datafusion/sql/src/relation/mod.rs:87–113  ·  view source on GitHub ↗

Create a `LogicalPlan` that scans the named relation. First tries any registered extension planners. If no extension handles the relation, falls back to the default planner.

(
        &self,
        relation: TableFactor,
        planner_context: &mut PlannerContext,
    )

Source from the content-addressed store, hash-verified

85 /// First tries any registered extension planners. If no extension handles
86 /// the relation, falls back to the default planner.
87 fn create_relation(
88 &self,
89 relation: TableFactor,
90 planner_context: &mut PlannerContext,
91 ) -> Result<LogicalPlan> {
92 let planned_relation =
93 match self.create_extension_relation(relation, planner_context)? {
94 RelationPlanning::Planned(planned) => planned,
95 RelationPlanning::Original(original) => {
96 Box::new(self.create_default_relation(*original, planner_context)?)
97 }
98 };
99
100 let optimized_plan = optimize_subquery_sort(
101 planned_relation.plan,
102 self.context_provider
103 .options()
104 .sql_parser
105 .enable_subquery_sort_elimination,
106 )?
107 .data;
108 if let Some(alias) = planned_relation.alias {
109 self.apply_table_alias(optimized_plan, alias)
110 } else {
111 Ok(optimized_plan)
112 }
113 }
114
115 fn create_extension_relation(
116 &self,

Callers 4

planMethod · 0.80
plan_table_with_joinsMethod · 0.80
parse_relation_joinMethod · 0.80

Calls 6

newFunction · 0.85
optimize_subquery_sortFunction · 0.85
apply_table_aliasMethod · 0.80
optionsMethod · 0.45

Tested by

no test coverage detected