Repository navigation
Conversation
polars removed DataFrame.groupby in 1.0 in favour of group_by, so PolarsBackend.groupby_agg raised AttributeError and any aggregation run by the local compute engine with backend=polars failed. Signed-off-by: Yihang Chen <yhc0720@berkeley.edu>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6965 +/- ##
=======================================
Coverage 49.49% 49.49%
=======================================
Files 443 443
Lines 55451 55451
Branches 8085 8085
=======================================
Hits 27443 27443
Misses 26110 26110
Partials 1898 1898
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
is this backward compatible? |
|
Yes, for any polars version that still exists in practice.
So the change keeps working on 0.19+ and fixes 1.x; the only versions it drops are pre-0.19 releases from over three years ago. Feast doesn't declare polars as a dependency or set a minimum version. If you'd rather keep pre-0.19 support anyway, I can add a The one failure in |
What this PR does / why we need it:
PolarsBackend.groupby_aggcallsdf.groupby(...). polars renamed that method togroup_byin 0.19 and removed the old name in 1.0, so with any current polars release (1.x and the new 2.0.0) the call raises:This means the local compute engine configured with
backend: polarsfails as soon as it runs aLocalAggregationNode. polars is not installed in CI, so the backend has no test coverage today (the factory tests mock it out).The fix switches to
group_by. A new test runsLocalAggregationNodewithPolarsBackend(sumandnunique, so then_uniquemapping is covered too); it usespytest.importorskip("polars"), so it is skipped where polars isn't installed.Which issue(s) this PR fixes:
No existing issue; found while running the compute engine tests with polars installed.
Checks
git commit -s)Testing Strategy
Local results (Python 3.12, CI requirements):
AttributeErrorabovetests/unit/infra/compute_engines: 117 passedlocal/test_nodes.py: 11 passedruff check,ruff format --checkandmypyon the changed files pass.Misc
While testing I also noticed that
LocalFilterNodeuses pandas-style boolean indexing (df[df[ts] <= df[entity_ts]]), which polars rejects, so historical retrieval with the polars backend still fails at that node. I kept this PR to the aggregation fix; happy to follow up on the filter node if that's useful.