These are invariants which should hold true before and after [`LogicalPlan`] optimization. This differs from [`LogicalPlan::check_invariants`], which addresses if a singular LogicalPlan is valid. Instead, this address if the optimization was valid based upon permitted changes.
(
plan: &LogicalPlan,
prev_schema: &Arc<DFSchema>,
)
| 500 | /// This differs from [`LogicalPlan::check_invariants`], which addresses if a singular |
| 501 | /// LogicalPlan is valid. Instead, this address if the optimization was valid based upon permitted changes. |
| 502 | fn assert_valid_optimization( |
| 503 | plan: &LogicalPlan, |
| 504 | prev_schema: &Arc<DFSchema>, |
| 505 | ) -> Result<()> { |
| 506 | // verify invariant: optimizer passes should not change the schema if the schema can't be cast from the previous schema. |
| 507 | // Refer to <https://datafusion.apache.org/contributor-guide/specification/invariants.html#logical-schema-is-invariant-under-logical-optimization> |
| 508 | assert_expected_schema(prev_schema, plan)?; |
| 509 | |
| 510 | Ok(()) |
| 511 | } |
| 512 | |
| 513 | #[cfg(test)] |
| 514 | mod tests { |
no test coverage detected
searching dependent graphs…