Skip to content

Navigation Menu

Sign in
Sign up

[SPARK-54966][PYTHON] Factor out legacy pandas-to-Arrow column conversion - #58751

Open
Spenserrrr wants to merge 1 commit into
apache:master from
Spenserrrr:write-leg-refactor
Open

[SPARK-54966][PYTHON] Factor out legacy pandas-to-Arrow column conversion #58751
Spenserrrr wants to merge 1 commit into
apache:master from
Spenserrrr:write-leg-refactor

Conversation

@Spenserrrr

@Spenserrrr Spenserrrr commented Sep 11, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Separate PandasToArrowConversion into three layers:

  • from_pandas(): batch handling and RecordBatch assembly.
  • convert(): per-column strategy dispatch.
  • convert_legacy(): the existing _create_converter_from_pandas() fix-ups, Arrow construction, cast fallback, and error translation.

The name convert_legacy identifies the existing conversion implementation retained during migration. Rename the separate is_legacy flag to use_legacy_error_handling to distinguish its exception/message policy from strategy selection, and update callers and tests.

Why are the changes needed?

Planned follow-ups are type-by-type migration from convert_legacy into convert_numpy, following the read leg's approach, and adding convert_pyarrow for Arrow-backed pandas Series (SPARK-54970) as part of the zero-copy pandas-UDF work. Establishing the batch/column boundary now lets those strategies evolve independently of batch handling while retaining the existing fallback.

Does this PR introduce any user-facing change?

No; this is an internal refactor.

How was this patch tested?

Existing conversion tests with pandas 2.3/PyArrow 24 and pandas 3/PyArrow 25, plus baseline-parity and error-handling probes.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Codex (GPT-6)

...sion
Separate batch handling in from_pandas from single-Series dispatch in
convert and the existing implementation in convert_legacy. Clarify the
legacy error-handling flag and update the worker callers and tests.
Spenserrrr marked this pull request as ready for review September 11, 2026 21:59

Copy link
Copy Markdown
Contributor Author

Hi @Yicong-Huang @zhengruifeng! This PR separates pandas-to-Arrow batch processing from column conversion. Right now, from_pandas() handles batch orchestration, and convert() selects the per-column strategy. This prepares the column layer for subsequent convert_numpy and convert_pyarrow implementations. Could you take a look when you have time? Thanks!
cc @gaogaotiantian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /