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

Method schema

datafusion/expr/src/logical_plan/plan.rs:325–361  ·  view source on GitHub ↗

Get a reference to the logical plan's schema

(&self)

Source from the content-addressed store, hash-verified

323impl LogicalPlan {
324 /// Get a reference to the logical plan's schema
325 pub fn schema(&self) -> &DFSchemaRef {
326 match self {
327 LogicalPlan::EmptyRelation(EmptyRelation { schema, .. }) => schema,
328 LogicalPlan::Values(Values { schema, .. }) => schema,
329 LogicalPlan::TableScan(TableScan {
330 projected_schema, ..
331 }) => projected_schema,
332 LogicalPlan::Projection(Projection { schema, .. }) => schema,
333 LogicalPlan::Filter(Filter { input, .. }) => input.schema(),
334 LogicalPlan::Distinct(Distinct::All(input)) => input.schema(),
335 LogicalPlan::Distinct(Distinct::On(DistinctOn { schema, .. })) => schema,
336 LogicalPlan::Window(Window { schema, .. }) => schema,
337 LogicalPlan::Aggregate(Aggregate { schema, .. }) => schema,
338 LogicalPlan::Sort(Sort { input, .. }) => input.schema(),
339 LogicalPlan::Join(Join { schema, .. }) => schema,
340 LogicalPlan::Repartition(Repartition { input, .. }) => input.schema(),
341 LogicalPlan::Limit(Limit { input, .. }) => input.schema(),
342 LogicalPlan::Statement(statement) => statement.schema(),
343 LogicalPlan::Subquery(Subquery { subquery, .. }) => subquery.schema(),
344 LogicalPlan::SubqueryAlias(SubqueryAlias { schema, .. }) => schema,
345 LogicalPlan::Explain(explain) => &explain.schema,
346 LogicalPlan::Analyze(analyze) => &analyze.schema,
347 LogicalPlan::Extension(extension) => extension.node.schema(),
348 LogicalPlan::Union(Union { schema, .. }) => schema,
349 LogicalPlan::DescribeTable(DescribeTable { output_schema, .. }) => {
350 output_schema
351 }
352 LogicalPlan::Dml(DmlStatement { output_schema, .. }) => output_schema,
353 LogicalPlan::Copy(CopyTo { output_schema, .. }) => output_schema,
354 LogicalPlan::Ddl(ddl) => ddl.schema(),
355 LogicalPlan::Unnest(Unnest { schema, .. }) => schema,
356 LogicalPlan::RecursiveQuery(RecursiveQuery { static_term, .. }) => {
357 // we take the schema of the static term as the schema of the entire recursive query
358 static_term.schema()
359 }
360 }
361 }
362
363 /// Used for normalizing columns, as the fallback schemas to the main schema
364 /// of the plan.

Callers 15

head_output_exprMethod · 0.45
recompute_schemaMethod · 0.45
with_new_exprsMethod · 0.45
fmtMethod · 0.45
projection_schemaFunction · 0.45
try_newMethod · 0.45
try_new_internalMethod · 0.45
is_scalarMethod · 0.45
try_new_with_schemaMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_filter_is_scalarFunction · 0.36