Repository navigation
Conversation
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>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Devin Review found 1 potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| entity_schema = dict( | ||
| zip(context.entity_df.columns, context.entity_df.dtypes) | ||
| ) |
There was a problem hiding this comment.
🟡 Pandas joins reject object-backed timestamps
For an unnamed-by-convention timestamp stored as object, LocalJoinNode now raises EntityTimestampInferenceException. The pandas backend already converts Python datetimes to a recognized dtype, but inference no longer uses it.
Learn more
LocalComputeEngine.get_historical_features builds a retrieval plan whose default join is created by build_join_node. The join converts the request DataFrame through Arrow, and PandasBackend.from_arrow returns a pandas DataFrame with the resulting types. Arrow can turn a pandas object column containing Python datetimes into a timestamp column. When neither timestamp name is explicit, infer_event_timestamp_from_entity_df requires exactly one recognized datetime dtype. Reading the original dtypes hides the converted timestamp from inference and aborts the join.
Example: Pass a pandas entity DataFrame with entity_id and ts, where ts contains Python datetimes parsed from 2025-11-01T09:00:00-04:00 and 2025-11-03T09:00:00-05:00. Pandas stores the mixed offsets as object, but the Arrow round trip yields a timezone-aware datetime column. The old pandas join infers ts; the new join raises an inference exception.
Recommended fix: Preserve inference from the converted DataFrame for the pandas backend and use a pandas-compatible schema for Polars. Add a regression case with a nonstandard timestamp column backed by object to cover the Arrow normalization.
Was this helpful? React with 👍 or 👎 to provide feedback.
What this PR does / why we need it:
Another small follow-up to #6965 / #6992 for the local compute engine's Polars backend.
LocalJoinNodeconvertscontext.entity_dfto a backend DataFrame and then infers the entity timestamp column from that DataFrame's dtypes:infer_event_timestamp_from_entity_dffalls back to "the only datetime column" when there is noevent_timestampcolumn, and it detects datetime columns with pandas'is_datetime64_any_dtype. That check does not recognise polars dtypes, so withbackend: polarsanentity_dfwhose timestamp column has another name raises:The same
entity_dfworks with the pandas backend.context.entity_dfis a pandas DataFrame at this point (it is passed topa.Table.from_pandason 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_dfwith atscolumn on both backends; the polars case usespytest.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
git commit -s)Testing Strategy
Local results (Python 3.12):
EntityTimestampInferenceException, the pandas case passestests/unit/infra/compute_engines: 196 passedlocal/test_nodes.py: 17 passedruff check,ruff format --checkandmypyonlocal/nodes.pypass.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).