Repository navigation
Conversation
49644be to
ebc48c8
Compare
There was a problem hiding this comment.
@richardliaw This is related to lance-format/lance#3850. At the current stage, for lance's count_rows, it is required not to pass count_rows. However, this is something that needs to be modified by lance.
Signed-off-by: jukejian <[email protected]> fix ut
ed1063c to
8faee0b
Compare
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
closes #15 We've identified that the count operation with filters returns incorrect results in the current Lance connector implementation. This issue has previously been addressed in our ray-project/ray#53162 by @Jay-ju. We'll be migrating the fix to this project to ensure: 1. Correct count results with various filter conditions 2. Proper handling of edge cases observed in our production workloads
|
@Jay-ju can you update PR description? |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
## Description Filtered Lance reads report fragment totals as exact output metadata. For a 28-row table filtered to seven rows, `count()` can return 28 and an 80/20 train/test split can produce 7/0 instead of 5/2. Return unknown row-count metadata for filtered reads and retain fragment counts for ordinary unfiltered reads. Scans with row-set-changing or unrecognized active options also use unknown metadata. Read-task planning does not perform a filtered count scan. Existing scanner options, snapshot and fragment scope, and Ray task limits are preserved. Ray computes filtered counts during execution; non-stratified splits materialize when the count is unknown and reuse the result. Separate actions on a non-deterministic filter may select different rows. Count-only execution may read payload columns because the Lance reader does not support automatic projection pushdown; users can explicitly select columns when appropriate. Regression coverage maps to the following changes: - Four filtered-planning cases detect restoring fragment totals or reintroducing a filtered planning scan. - Six row-set option cases detect returning fragment totals for active options; `limit=0` also detects treating zero as absent. - A dictionary-valued search filter returns unknown planning metadata. It fails with the original fragment totals and passes with the previous pre-count implementation. This case does not execute Lance search. - Public count/split checks for the direct filter and the scanner-options filter fail with original fragment-total metadata. The direct-filter case also checks an empty filtered result on the fixed implementation. - A pushed-filter count/split case includes a `take(1)` guard against an extra planning scan. It passes against the original datasource but fails when the previous planning scan is restored. - A random-filter split checks output ratio, disjoint IDs and row counts through the public API; it failed with the original fragment-total metadata in the recorded control. - The unfiltered fast-path test protects metadata counting without an unnecessary data scan. It passes against the original datasource but fails when unfiltered counts are made unknown. Feedback on retaining these two targeted guards is welcome. ## Related issues Fixes #67227. #53162 addressed the same root cause but was closed without merging; no active overlapping filtered-count fix was found. #66472 concerns separate split-rounding and stratification issues. ## Additional information Validation used the complete Ray Data Python source from this checkout with the Ray 2.59.0 native wheel on Linux ARM64 / Python 3.12.14: - `python -m pytest -v python/ray/data/tests/datasource/test_lance.py`: 45 passed with PyLance 4.0.0 / PyArrow 23.0.1, including 15 new regression cases and one augmented existing version test. No tests were skipped. - Negative controls covered original fragment totals, the previous filtered pre-count, zero-valued options treated as absent, and unfiltered counts made unknown. Case-specific outcomes are summarized above. - The unchanged `limit=0` metadata and random-filter split cases previously passed with PyLance 2.0.1 / PyArrow 23.0.1 and PyLance 12.0.0 / PyArrow 23.0.1. These two-case results were reused after AST, fixture and datasource fingerprint checks. The dictionary-filter case was exercised on the primary baseline only. - Ruff, import ordering, Black 22.10.0, configured Pydoclint and whitespace checks passed. These are Python-source tests with a released native runtime, not a matching master native build. The runtime uses the existing fallback that disables application-level lineage reconstruction; matching-runtime CI is required before merge. No real S3 or media integration tests were run for this test-only revision. AI assistance: Codex was used for implementation, testing and documentation. --------- Signed-off-by: jiangxt2 <[email protected]>
Why are these changes needed?
Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.