Repository navigation
Fix incorrect partition length metadata for Partitions expression - #12290
abslock128w wants to merge 19 commits into
Conversation
On minimal pandas versions, concatenation of categorical data does not guarantee stable ordering of values, even when categories and dtypes match. The test was asserting positional equality for categorical Series, which is stronger than the guarantees provided by pandas and leads to frequent failures in mindeps-optional.
Removed redundant checks for categorical values in concat tests.
Add a test to verify that the length of partitions matches the computed length.
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 21 files ± 0 21 suites ±0 5h 8m 42s ⏱️ +38s For more details on these failures, see this check. Results for commit c1d0d02. ± Comparison against base commit 6ac1553. ♻️ This comment has been updated with latest results. |
Remove unnecessary blank line in test_multi.py
crusaderky
left a comment
There was a problem hiding this comment.
This PR fundamentally misunderstands the issue.
I did not run the code. However, either of these two statements is true:
- this PR does nothing (the new
_lengthmethod is never executed); in the unit test,len(part)still continues computing the concrete result (which has always worked and is tested under normal conditions) - OR this test fundamentally breaks len(Dataframe), so that in one specific niche use case it stops computing and instead returns NaN, whereas in many other cases (e.g. after a filter operation) it continues triggering a partial computation as before - which is typically desirable, since predicate pushdown allows skipping most of the work that used to be implied in the past (such as loading the full data to disk).
In both cases, the unit test passes before and after the change, which makes it not fit for purpose.
This PR also does not answer the question as of why, in most runs, the original unit test passes. This PR implies that the issue is deterministic, which clearly isn't.
|
Hmm makes sense |
test_collection.py::test_len#12275pre-commit run --all-filesPartition slicing via
df.partitions[...]could incorrectly reuse concretelength metadata from the parent expression, leading to mismatches between
metadata length and computed results and causing flaky test failures....
that partition length metadata is only reported when it can
be inferred correctly. I also added a regression test to verify that any concrete
length reported for a partition always matches the computed length.
please do have look and lmk if this work!!