← 输入框|github.com|刷新
Skip to content

fix: Infer the entity timestamp column with the Polars backend - #7004

Open
YHC66 wants to merge 1 commit into
feast-dev:masterfrom
YHC66:fix-polars-backend-entity-ts-inference
Open

YHC66 wants to merge 1 commit into
feast-dev:masterfrom
YHC66:fix-polars-backend-entity-ts-inference

Conversation

@YHC66

@YHC66 YHC66 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Another small follow-up to #6965 / #6992 for the local compute engine's Polars backend.

LocalJoinNode converts context.entity_df to a backend DataFrame and then infers the entity timestamp column from that DataFrame's dtypes:

entity_df = self.backend.from_arrow(pa.Table.from_pandas(context.entity_df))

entity_schema = dict(zip(entity_df.columns, entity_df.dtypes))
entity_ts_col = infer_entity_timestamp_column(entity_schema)

infer_event_timestamp_from_entity_df falls back to "the only datetime column" when there is no event_timestamp column, and it detects datetime columns with pandas' is_datetime64_any_dtype. That check does not recognise polars dtypes, so with backend: polars an entity_df whose timestamp column has another name raises:

EntityTimestampInferenceException: Please provide an entity_df with a column named event_timestamp representing the time of events.

The same entity_df works with the pandas backend.

context.entity_df is a pandas DataFrame at this point (it is passed to pa.Table.from_pandas on the line above), so the schema for the inference is now taken from it. Nothing changes for the pandas backend.

A new parametrized test joins against an entity_df with a ts column on both backends; the polars case uses pytest.importorskip("polars"), so it is skipped where polars isn't installed.

Which issue(s) this PR fixes:

No existing issue; found while comparing the local nodes' output between the two backends.

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

Local results (Python 3.12):

Setup Result
master + polars 2.0.0, new test the polars case fails with EntityTimestampInferenceException, the pandas case passes
this branch + polars 2.0.0 tests/unit/infra/compute_engines: 196 passed
this branch + polars 1.34.0 local/test_nodes.py: 17 passed
this branch, polars not installed 192 passed, 4 skipped

ruff check, ruff format --check and mypy on local/nodes.py pass.

Misc

With this in, the join, dedup, filter and aggregation nodes gave the same output on both backends for the inputs I compared (with and without an entity_df, several inputs, TTL and expression filters, the supported aggregation functions).

LocalJoinNode inferred the entity timestamp column from the dtypes of the
backend DataFrame. The inference only recognises pandas datetime dtypes,
so with the Polars backend an entity_df whose timestamp column is not
named event_timestamp raised EntityTimestampInferenceException. Infer it
from the pandas entity_df instead.

Signed-off-by: Yihang Chen <yhc0720@berkeley.edu>
@YHC66
YHC66 requested a review from a team as a code owner October 13, 2026 17:33
@codecov-commenter

codecov-commenter commented Oct 13, 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 51.01%. Comparing base (2dfb9e6) to head (986abac).
❗ 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    #7004      +/-   ##
==========================================
- Coverage   51.02%   51.01%   -0.02%     
==========================================
  Files         452      452              
  Lines       56728    56728              
  Branches     8265     8265              
==========================================
- Hits        28946    28937       -9     
- Misses      25801    25809       +8     
- Partials     1981     1982       +1     
Flag Coverage Δ
go-feature-server 30.37% <ø> (-0.21%) ⬇️
python-unit 52.49% <100.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
.../python/feast/infra/compute_engines/local/nodes.py 87.37% <100.00%> (ø)

... and 2 files with indirect coverage changes


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 2dfb9e6...986abac. 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