Skip to content

Conversation

@amerberg
Copy link
Contributor

@amerberg amerberg commented Dec 12, 2025

This is a followup to #2118, which allowed us to avoid materializing full level values of MultiIndex levels for successful validation. That PR, however, fell back to full materialization upon hitting a schema error, to ensure that failure cases would be reported correctly. This PR extends the benefit of the optimization to failing validations by joining the failure_cases from the unique values to a lookup table to build the failure_cases for the full values.

This should be particularly beneficial for running validations that are expected to fail, such as validating against a union DataFrame[Schema1] | DataFrame[Schema2] | DataFrame[Schema3] where any given dataframe is only expected to conform to one of the schemas.

@amerberg amerberg changed the title Avoid full ma Avoid full materialization of levels in failing MultiIndex levels Dec 12, 2025
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 97.05882% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.90%. Comparing base (f5c55cb) to head (f97808d).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
pandera/backends/pandas/components.py 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2187      +/-   ##
==========================================
+ Coverage   81.51%   83.90%   +2.38%     
==========================================
  Files         137      137              
  Lines       10898    10631     -267     
==========================================
+ Hits         8884     8920      +36     
+ Misses       2014     1711     -303     

☔ 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.

Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
@amerberg amerberg force-pushed the expand_unique_failure_cases branch from 1dc390d to 533803b Compare December 12, 2025 23:14
Signed-off-by: Adam Merberg <[email protected]>
@amerberg amerberg changed the title Avoid full materialization of levels in failing MultiIndex levels Avoid full materialization of levels in failing MultiIndex validations Dec 13, 2025
Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
Signed-off-by: Adam Merberg <[email protected]>
@amerberg amerberg marked this pull request as ready for review December 29, 2025 23:26
@cosmicBboy
Copy link
Collaborator

thanks @amerberg !

@cosmicBboy cosmicBboy merged commit 7055cbd into unionai-oss:main Jan 6, 2026
224 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants