Skip to content

fix(python): Add PerformanceWarning to LazyFrame.__contains__ - #26738

Closed
anihal wants to merge 1 commit into
pola-rs:mainfrom
anihal:fix/lazyframe-contains-warning
Closed

fix(python): Add PerformanceWarning to LazyFrame.__contains__#26738
anihal wants to merge 1 commit into
pola-rs:mainfrom
anihal:fix/lazyframe-contains-warning

Conversation

@anihal

@anihal anihal commented Feb 27, 2026

Copy link
Copy Markdown

Closes #21917

What changed

'col' in lf silently called collect_schema() without warning the user. All other schema-resolving properties (.columns, .dtypes, .schema, .width) already emit a PerformanceWarning via issue_warning(); __contains__ was overlooked.

Fix

Added issue_warning(..., category=PerformanceWarning) to __contains__ before the collect_schema() call, matching the existing pattern.

Tests

Extended test_lf_properties with two assertions — one for a present column, one for an absent column — both asserting the warning is emitted.

`'col' in lf` silently resolved the schema via collect_schema().
All other schema-resolving properties (.columns, .dtypes, .schema,
.width) already emit a PerformanceWarning; __contains__ was missed.
@anihal

anihal commented Feb 27, 2026

Copy link
Copy Markdown
Author

Closing — PR #26734 already covers this fix.

@anihal anihal closed this Feb 27, 2026
@anihal anihal reopened this Mar 1, 2026
@anihal anihal changed the title fix(python): issue PerformanceWarning on LazyFrame.__contains__ fix(python): Add PerformanceWarning to LazyFrame.__contains__ Mar 1, 2026
@github-actions github-actions Bot added fix Bug fix python Related to Python Polars and removed title needs formatting labels Mar 1, 2026
@anihal anihal closed this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix python Related to Python Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LazyFrame.__contains__ does not issue PerformanceWarning

1 participant