Repository navigation
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6776 +/- ##
=======================================
Coverage 47.62% 47.62%
=======================================
Files 422 422
Lines 52352 52353 +1
Branches 7596 7596
=======================================
+ Hits 24931 24935 +4
+ Misses 25646 25640 -6
- Partials 1775 1778 +3
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
This is rebased on master and green (aside from an unrelated flaky macOS test) — happy to make any changes if something would help move review along. |
eacdb89 to
5de9310
Compare
|
@pujitha24 It would be good to validate that file_format of a data source object always has a valid value ? The fix could to validate file_format at FileSource construction time (fail-fast at definition time, not query time). |
|
@ntkathole A construction-time check would reject sources that work today. Outside the DuckDB store, |
…uckDB offline store Motivation: When using the DuckDB/ibis offline store, a FileSource whose file_format could not be determined (file_format not set and the path does not end in ".parquet", and it is not a Delta table) caused `_read_data_source()` in duckdb.py to fall through its if/elif chain and implicitly return None. That None then propagated to callers that called `.mutate(...)` on it, crashing several stack frames away from the real problem with `AttributeError: 'NoneType' object has no attribute 'mutate'`, with no indication of the actual cause. Approach: Add an explicit `else` branch to `_read_data_source()` that raises a `ValueError` explaining that the file format could not be determined, and suggesting the user either set `file_format` explicitly on the FileSource (e.g. ParquetFormat()) or use a path with a recognized extension (e.g. ".parquet"). This replaces a silent None return with an actionable error at the point where the format could not be resolved. Validation: Added sdk/python/tests/unit/infra/offline_stores/test_duckdb.py, which constructs a FileSource with an unresolvable format (a ".csv" path, no explicit file_format) and asserts that `_read_data_source` raises ValueError. Report: feast-dev#5390 Signed-off-by: Pujitha Paladugu <[email protected]> Assisted-by: claude-sonnet-5 (via Claude Code)
0ea39b6 to
050fd19
Compare
What this PR does / why we need it:
When using the DuckDB/ibis offline store, a
FileSourcewhosefile_formatcould not bedetermined (not set explicitly, and the path doesn't end in
.parquet, and it isn't aDelta table) caused
_read_data_source()induckdb.pyto fall through itsif/elifchain and implicitly return
None. ThatNonethen propagated intoibis.py'sread_fv(), which calls.mutate(...)on it, crashing several stack frames away from thereal problem with
AttributeError: 'NoneType' object has no attribute 'mutate', giving theuser no indication of the actual cause.
This PR adds an explicit
elsebranch that raises a clearValueErrorat the point wherethe format could not be resolved, telling the user to either set
file_formatexplicitlyon the
FileSourceor use a path with a recognized extension (e.g..parquet).This does not change behavior for any currently-working
FileSource:feast/data_format.pyonly defines
ParquetFormatandDeltaFormat, both of which are already handled by thepreceding branches. It only replaces a silent
Nonereturn with an actionable error.Which issue(s) this PR fixes:
Fixes #5390
Checks
git commit -s)Testing Strategy
Added
sdk/python/tests/unit/infra/offline_stores/test_duckdb.py, which constructs aFileSourcewith an unresolvable format (a.csvpath, no explicitfile_format) andasserts that
_read_data_sourceraisesValueError. Confirmed the test fails withDID NOT RAISE <class 'ValueError'>against the code before this change, and passes after.Ran:
uv run python -m pytest sdk/python/tests/unit/infra/offline_stores/— 227 passed, 20 skippeduv run ruff check/uv run ruff format --checkon both changed files — cleanuv run mypy feast/infra/offline_stores/duckdb.py— no issuesMisc
Note: base
masterCI was green at the time of this PR (checked viagh run list).