fix: Correctly evaluate pl.len() with lazy validation in plan#371
Merged
Conversation
Oliver Borchert (borchero)
marked this pull request as ready for review
July 22, 2026 10:03
Oliver Borchert (borchero)
requested a review
from Andreas Albert (AndreasAlbertQC)
as a code owner
July 22, 2026 10:03
Oliver Borchert (borchero)
requested a review
from Daniel Elsner (delsner)
as a code owner
July 22, 2026 10:03
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an incorrect pl.len() result when using pl.scan_parquet(...).pipe(schema.validate, eager=False) by adjusting the Polars plugin fast-path for the “no rule failures” case, and adds coverage to prevent regressions.
Changes:
- Add a regression test asserting
pl.len()remains correct after lazy validation on a scanned parquet. - Update the Rust
all_rules_requiredplugin to return an all-trueboolean bitmap (length = input) when there are no validation failures, to support a filter fast-path. - Extend the row-wise validation benchmark to parameterize eager vs lazy validation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/schema/test_validate.py | Adds a regression test for lazy validation over scan_parquet ensuring pl.len() stays correct. |
| tests/benches/test_schema.py | Updates benchmark to cover both eager and lazy validation modes. |
| src/polars_plugin/mod.rs | Changes all_rules_required success-path output to a full-length all-true bitmap series to avoid incorrect lazy plan behavior. |
Andreas Albert (AndreasAlbertQC)
approved these changes
Jul 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #371 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 3507 3507
=========================================
Hits 3507 3507 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Moritz Potthoff (@MoritzPotthoffQC) discovered a bug where
pl.len()was reported incorrectly.