Skip to content

fix(freshcore): fall back for missforest, per-column strategies, non-finite outliers and nullable bools; honour native duplicate counts - #375

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/freshcore-fallbacks
Sep 15, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/freshcore-fallbacks

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

The FreshCore adapter ran several configs natively that its v1 kernels silently get wrong. They now fall back to the pandas reference through the existing fallback path, so fallback_policy="error" raises FallbackError and reports record the event.

Known gap: with fix_dtypes=True, native string casts can still create boolean columns with missing values or float columns holding inf, which the input-dtype checks don't see.

Tests

New tests/test_execution/test_freshcore_fallbacks.py, using a fake native module:

  • Each issue repro records the fallback reason, matches the pandas output and actions, and raises under fallback_policy="error".
  • fd.plan() shows the same reason as the recorded fallback.
  • Supported data stays native.
  • FreshCore engine skips duplicate detection; duplicate_ratio_action='error' never raises #323: a reported duplicates_detected produces the pandas detection action, warning and recommendation, and raises DuplicateRatioError under "error". A missing key skips detection, or falls back under "error". drop_duplicates=True escalates and warns like pandas.

Verification

  • ruff check . clean; mypy src/freshdata clean (202 files)
  • Python 3.12: 4271 passed, 6 skipped
  • Python 3.9: 4267 passed, 10 skipped
  • 19 of the 26 new tests fail against main's src

Closes #322
Closes #334
Closes #335
Refs #323 (Python adapter only; the native engine still needs to report duplicates)

…finite outliers and nullable bools; honour native duplicate counts

The FreshCore adapter ran several configs natively that its v1 kernels
silently get wrong. It now delegates them to the pandas reference through
the existing fallback path, so fallback_policy="error" raises FallbackError
and reports record the event.

- impute="missforest" and per-column impute_strategy: the native imputer
  ignores both, so nothing was filled. _unsupported_reason() now falls back
  with the same reasons as PlanGenerator.fallback_reason(), so fd.plan()
  and the recorded event agree. PlanGenerator now treats an empty
  impute_strategy mapping as a no-op, matching the pandas imputer.
- Outliers on float columns holding +/-inf: the native fences don't
  exclude non-finite values, so zscore and IQR flag or clip nothing. When
  outliers is set, a vectorised np.isinf scan of float columns triggers a
  fallback naming the columns.
- impute="mode"/"auto" with missing values in a nullable boolean column:
  the native kernel skips boolean data. Fall back when such a column has
  some (not all) values missing.
- Duplicate ratio: when the native result carries duplicates_detected, the
  adapter reports it through report_detected_duplicates(), in pandas action
  order, using the row count after empty-row removal. With
  drop_duplicates=True, the native drop count goes through
  check_duplicate_ratio(), so duplicate_ratio_action="error" raises and
  high ratios warn. A missing key skips detection, except under
  duplicate_ratio_action="error", where the run falls back so the
  escalation is not silently lost.

The fallback matrix, backends and FreshCore docs list the new triggers.

Closes #322
Closes #334
Closes #335
Refs #323 (Python adapter only; the native engine still needs to report duplicates)
@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: 83530d0a-42a1-433d-9781-92f06eb470e8


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 969af3c into main Sep 15, 2026
21 checks passed
kevincostner17 added a commit that referenced this pull request Sep 15, 2026
Add Unreleased Added, Changed and Fixed entries for merged PRs #351,
#352, #353, #354, #356, #357, #358, #360, #361, #362, #363, #364, #365,
#367, #368, #369, #370, #371, #372, #374, #375, #377, #378 and #379.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant