# 5. Refactor schema rewriter groundwork * **Goal:** Prepare `PhysicalExprAdapter` internals for the final switch without changing external behavior. * **Scope & Location:** `datafusion/physical-expr-adapter/src/schema_rewriter.rs` (and any helpers it calls). * **Key Tasks:** * Isolate the structural cleanup already proposed (e.g., factor out helper functions, introduce quick struct compatibility checks) while keeping current cast behavior. * Add/adjust tests ensuring no functional change (existing `CastExpr` path still used). * Document new helper responsibilities to aid the next PR. * **Dependencies:** Independent of specs #17760, #17761, #17762, #17763 but should land before spec #6 to minimize diff. * **Out of Scope:** Introducing `CastColumnExpr` usage.