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

Method check

datafusion/core/src/physical_planner.rs:3114–3136  ·  view source on GitHub ↗

Checks that the plan change is permitted, returning an Error if not. Conditionally performs schema checks per [PhysicalOptimizerRule::schema_check]. In debug mode, this recursively walks the entire physical plan and performs [`ExecutionPlan::check_invariants`].

(
        &mut self,
        plan: &Arc<dyn ExecutionPlan>,
        previous_schema: &Arc<Schema>,
    )

Source from the content-addressed store, hash-verified

3112 /// In debug mode, this recursively walks the entire physical plan
3113 /// and performs [`ExecutionPlan::check_invariants`].
3114 pub fn check(
3115 &mut self,
3116 plan: &Arc<dyn ExecutionPlan>,
3117 previous_schema: &Arc<Schema>,
3118 ) -> Result<()> {
3119 // if the rule is not permitted to change the schema, confirm that it did not change.
3120 if self.rule.schema_check()
3121 && !is_allowed_schema_change(previous_schema.as_ref(), plan.schema().as_ref())
3122 {
3123 internal_err!(
3124 "PhysicalOptimizer rule '{}' failed. Schema mismatch. Expected original schema: {}, got new schema: {}",
3125 self.rule.name(),
3126 previous_schema,
3127 plan.schema()
3128 )?
3129 }
3130
3131 // check invariants per each ExecutionPlan node
3132 #[cfg(debug_assertions)]
3133 plan.visit(self)?;
3134
3135 Ok(())
3136 }
3137}
3138
3139/// Checks if the change from `old` schema to `new` is allowed or not.

Callers 4

check_scalarMethod · 0.80

Calls 5

is_allowed_schema_changeFunction · 0.85
schema_checkMethod · 0.45
as_refMethod · 0.45
schemaMethod · 0.45
visitMethod · 0.45

Tested by 2