Skip to content

fix(engine): materialize Spark DataFrames in the pandas fallback - #425

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/spark-materialize
Sep 15, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/spark-materialize

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

fd.clean(spark_df) raised TypeError: cannot materialize source of type DataFrame. Under the default strategy="balanced", a non-pandas source is materialized to pandas, but materialize_to_pandas (execution/backends/_pandas.py) only probed to_pandas (polars) and df (DuckDB). A Spark DataFrame exposes toPandas(), so any Spark input crashed before cleaning ran.

Change

Add a toPandas() probe after the DuckDB df probe (collecting to the driver, which is what the balanced-strategy fallback does). Latent since the multi-engine dispatch landed; not a regression.

Tests

tests/test_execution/test_dispatch_and_config.py: a fake Spark-style frame exposing only toPandas materializes correctly. (The real-pyspark tests importorskip and cover the end-to-end path in CI's extras lanes.)

Verification

  • New test passes on Python 3.12 / pandas 2.3.3 and Python 3.9 / pandas 1.5.3; ruff check clean.
  • The remote OS matrix (this campaign) confirmed the crash on pyspark 4.2.0 and 3.5.6.

Found by the production-readiness test campaign (lane L1a, FDC-L1a-001).

fd.clean(spark_df) raised TypeError: cannot materialize source of type
DataFrame. The balanced-strategy pandas fallback probed to_pandas (polars) and
df (duckdb) but not a Spark DataFrame's toPandas(), so any Spark input crashed
before cleaning. Add a toPandas() probe. Found by the production-readiness
campaign (FDC-L1a-001).
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8447a670-b0bb-44a0-96b4-2a967952eadf


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

FreshData benchmark report — performance

  • freshdata: ?
  • python: ?
  • platform: ?
fixture n_rows n_cols p50 s p95 s peak MB repair % false-repair % preserve % trust monotonic export %

Authored-code reduction (Metric 6)

@kevincostner17
kevincostner17 merged commit bcd8b5d into main Sep 15, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant