fix(engines): disclose ingestion fallbacks; validate engine/output_format pairs - #226
Merged
Merged
Conversation
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
…rmat pairs - #206: a pandas source whose object column mixes value types crashed the Polars engine during pl.from_pandas and was silently cast to text by DuckDB, and duplicate column labels crashed Polars and came back mis-renamed from DuckDB. execution/_ingest.py now flags those inputs before ingestion, and both engines take the recorded pandas fallback (fallback_policy="error" still raises first). The Polars engine now decides fallbacks before converting the source. - #205: requesting another engine's native handle silently returned a different type, even under fallback_policy="error" (e.g. engine="duckdb" with output_format="polars-lazy" returned a DuckDBPyRelation). EngineConfig now rejects the pairing with a ValueError; engine="auto" (and the default engine) picks the engine that owns the handle format. _convert_output returns a materialized frame in place of a handle only when the report records the pandas fallback. Docs: fallback-matrix lists the two input-driven fallbacks; backends.md says a handle format needs its own engine. Closes #205 Closes #206
kevincostner17
force-pushed
the
fix/engine-ingestion
branch
from
September 14, 2026 20:06
74e68db to
2a3ae88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#206: inputs native engines can't ingest faithfully.
[1, "a", None]) crashed the Polars engine insidepl.from_pandas. DuckDB silently cast it to text (1became'1').['x_2', 'x_1']).execution/_ingest.py::pandas_ingest_fallback_reasonflags both cases before ingestion. The engines then take the recorded pandas fallback, so output matches the pandas engine andreport.fallback_eventsnames the column.fallback_policy="error"still raises before any pandas work.#205: a mismatched native handle silently returned the wrong type, even under
fallback_policy="error". For example,engine="duckdb", output_format="polars-lazy"returned aDuckDBPyRelation.EngineConfignow rejects an explicit engine paired with another engine's handle format, raisingValueError(the chosen option for Mismatched engine/output_format silently returns the wrong type, even with fallback_policy='error' #205). The message names the right engine.engine="auto", or the default engine, picks the engine that owns the format:fd.clean(df, output_format="duckdb")returns a relation._convert_outputonly returns a materialized frame in place of a handle when the report records the pandas fallback. Anything else raises instead of substituting silently.Docs:
docs/fallback-matrix.mdlists the two input-driven fallbacks and points at_ingest.py.docs/backends.mdsays a handle format needs its own engine.Tests
tests/test_execution/test_ingest_and_output_format.py:['x', 'x_2']) on Polars and DuckDB.EngineConfigrejects every foreign engine/handle pair, including underfallback_policy="error".autoand the default engine select the owning engine, and a handle request that falls back returns disclosed pandas output.Verification
pytest -m "not online and not large"on Python 3.12 (numpy 2.5) and 3.9 (pandas 1.5.3).CleanResultwrapper with a plain DataFrame. That test is fixed and passes 22/22 on both Python versions.ruff check .,mypy src/freshdataandmkdocs build --strictpass.This touches
backends/_duckdb.pyand_polars.pyin different hunks from #223 and #224. Whichever merges later gets rebased.Closes #205
Closes #206