Skip to content

PhysicalExprAdapter - Schema Rewriter Cleanup #20161

@kosiew

Description

@kosiew

Refactor PhysicalExprAdapter and schema rewriter utilities to improve maintainability, extract helper functions, and update the factory pattern to be fallible. All changes must remain behavior-preserving.

Scope

This PR focuses on cleanup and refactoring only — no behavioral changes.

Tasks

  • Refactor schema rewriter utilities for clarity
  • Extract reusable helper functions (nullability checks, metadata propagation, etc.)
  • Update adapter factory pattern to support fallible initialization
  • Consolidate duplicate logic in schema adaptation paths
  • Add unit tests to validate refactored code is behavior-preserving

Files/Modules

  • datafusion/physical-expr-adapter/src/schema_rewriter.rs
  • datafusion/physical-expr-adapter/src/lib.rs
  • Related adapter tests

Acceptance Criteria

✅ All existing tests pass without modification
✅ Refactored code is clearer and more maintainable
✅ No change in adapter output or behavior
✅ New helper functions are well-documented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions