Skip to content

Conversation

@kdn36
Copy link
Collaborator

@kdn36 kdn36 commented Nov 6, 2025

This PR introduces ElementExpr and extends the in-memory engine physical ExecutionState such that any input, once evaluated, is retained for pl.element().

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars labels Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 75.34247% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.79%. Comparing base (eba9beb) to head (a0c3fd6).
⚠️ Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-expr/src/expressions/element.rs 59.25% 11 Missing ⚠️
crates/polars-expr/src/expressions/eval.rs 84.09% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25199      +/-   ##
==========================================
- Coverage   81.81%   81.79%   -0.02%     
==========================================
  Files        1709     1712       +3     
  Lines      236261   236496     +235     
  Branches     3005     3007       +2     
==========================================
+ Hits       193292   193440     +148     
- Misses      42201    42287      +86     
- Partials      768      769       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


out = df.select(pl.col.a.list.eval(expr).over(42))
print(out)
print(df)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove stray prints

branch_idx: self.branch_idx,
flags: self.flags.clone(),
ext_contexts: self.ext_contexts.clone(),
element: self.element.clone(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we certain this should clone here? Otherwise I think we should be conservative and clear it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would lead to problems, as .split() is also called in BinaryExpr and TernaryExpr and thus would clear the element for different inputs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. We should add a test case for this then, I imagine it's hit by something like list.eval(pl.when(pl.element()..).then(pl.element()..))

@kdn36 kdn36 marked this pull request as draft November 7, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants