Skip to content

fix: Keep the dataframe index out of write_to_offline_store - #7160

Open
anishmehta24 wants to merge 1 commit into
feast-dev:masterfrom
anishmehta24:fix-offline-write-df-index
Open

anishmehta24 wants to merge 1 commit into
feast-dev:masterfrom
anishmehta24:fix-offline-write-df-index

Conversation

@anishmehta24

@anishmehta24 anishmehta24 commented Nov 13, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

write_to_offline_store builds its Arrow table with pa.Table.from_pandas(df). When the dataframe has a non-default index, for example after filtering rows, pyarrow adds the index as an __index_level_0__ column, and the file offline store rejects the write because the columns no longer match the batch source:

ValueError: The input pyarrow table has schema ... with the incorrect columns ['driver_id', 'conv_rate', 'trips', 'event_timestamp', 'created', '__index_level_0__'] ...

push() with PushMode.OFFLINE or ONLINE_AND_OFFLINE goes through the same path. This passes preserve_index=False, like the other from_pandas calls in the offline stores already do.

Which issue(s) this PR fixes:

None filed.

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Misc

Added test_write_to_offline_store_does_not_write_the_dataframe_index to tests/unit/test_unit_feature_store.py; it fails on master and passes with the change (the file: 7 passed). I only ran that file, not the full suite. Manually, against a local FileSource repo, writing a filtered dataframe now succeeds instead of raising, and a dataframe with a default index writes as before. ruff 0.16.10 check and format pass.


Devin Review

pa.Table.from_pandas stores a non-default index as an __index_level_0__ column, so a filtered dataframe reached the offline store with one column too many and the file offline store rejected it.

Signed-off-by: Anish Mehta <[email protected]>
@anishmehta24
anishmehta24 requested a review from a team as a code owner November 13, 2026 23:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T23:50:54.341351Z b84b4c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

provider.ingest_df_to_offline_store.assert_called_once()


def test_write_to_offline_store_does_not_write_the_dataframe_index():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Missing test return type annotation

The new test omits -> None, despite the repository's requirement to type-hint every Python function signature.

Suggested change
def test_write_to_offline_store_does_not_write_the_dataframe_index():
def test_write_to_offline_store_does_not_write_the_dataframe_index() -> None:

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@codecov-commenter

codecov-commenter commented Nov 14, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.45%. Comparing base (cc17aad) to head (b84b4c1).
⚠️ Report is 2 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7160   +/-   ##
=======================================
  Coverage   52.45%   52.45%           
=======================================
  Files         459      459           
  Lines       58172    58172           
  Branches     8577     8577           
=======================================
+ Hits        30515    30517    +2     
+ Misses      25573    25572    -1     
+ Partials     2084     2083    -1     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 53.96% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/feature_store.py 47.64% <100.00%> (+0.11%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc17aad...b84b4c1. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants