Repository navigation
Preserve filtered view positions in top-k results - #3176
dajiaohuang wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe filtered-column top-k adapter now scans the full view when expanding a caller filter. It maps each source result to every matching filtered-view position that passes that filter. ChangesFiltered top-k query mapping
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~7 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to Filtered top-k results preserve matching view positions, including sparse and repeated indices. No concrete merge-blocking issue is established. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checked each view-wide row, Comment |
khustup2
left a comment
There was a problem hiding this comment.
The bound fix is right: cardinality() is not an index bound, so a sparse filter was truncated. Two questions before this can go in:
- Removing
breakchanges behavior whenindices_repeats a source index. Show a case where a filtered view holds duplicate source indices. If no such case exists, keep thebreak. - Add a test that fails on the old code: a filter whose highest set bit is above its cardinality, and a top-k query over it. The test must run through the real column classes, not a reimplementation.
|
Restored Added three real-column integration cases using an embedding column and a reordered |
|
Added actual-class before/after coverage in 08b7062 (cpp/tests/filtered_column_query_test.cpp and cpp/tests/README.md). The old header fails the highest-bit-above-cardinality case, the multiple sparse-bit case, and the eligible duplicate case; with the PR header all five tests pass, including both first-match controls. Filtering and reverse mapping execute the real filtered_column class with an array_column source, not a copied algorithm. Only index-search results are controlled. The standalone test explicitly qualifies the inline method with test-only access: ordinary virtual dispatch uses the old public SDK vtable, as confirmed by its R_X86_64_COPY relocation. The documented 4.4.4 SDK matches the class interface; 4.5.2 changes ABI types and cannot be mixed with this definition. This supplies native component evidence for the requested regression, while full patched Python-extension/query-planner/index integration remains unverified. The existing three nested real-dataset tests remain separate integration coverage. |
khustup2
left a comment
There was a problem hiding this comment.
Source change approved: the cardinality bound was wrong (cardinality is not an index bound) and the filter-aware reverse mapping with break restored keeps the first-match behavior. The regression test proves the point but cannot land as written: #define private public and a standalone main at the cpp/tests root are outside our harness, and the vtable workaround is a symptom of testing against a prebuilt SDK rather than the tree. We will carry the fix with a gtest in cpp/tests/heimdall against the source.
Fixes #3175.
Translate a caller's sparse view-space filter across the complete index mapping rather than stopping at its cardinality. Mapping source hits back also respects that filter. Preserve the original first-match behavior for duplicate source indices; this patch does not expand top-k hits into every duplicate view position.
Added real-dataset regressions in
python/tests/test_filtered_column_query.py: an embedding column, reordered view[9, 2, 7], one-row filters at positions 1 and 2, and an unfiltered top-k ordering check. The tests execute nested dataset queries rather than copying the mapping algorithm.Added a standalone native regression in cpp/tests/filtered_column_query_test.cpp with reproduction instructions in cpp/tests/README.md. It executes the actual filtered_column and array_column classes, controlling only the source index-search results. It explicitly calls the inline method because the public SDK owns an old vtable through an out-of-line key function. No mapping algorithm is copied. With the ABI-compatible 4.4.4 SDK, CRoaring 4.2.1 and Abseil 20240116.2, the old header fails three cases and passes two first-match controls; the PR header passes all five.
Validation: native class before/after checks, Black, clang-format and git diff --check pass. The three Python real-dataset tests pass against the published Linux 4.5.1 wheel, validating fixture/API only. The native class regression is isolated component evidence; it does not validate the query planner, actual index search, PostgreSQL integration or patched Python extension. The checkout supplies no Python extension build target, so full patched-extension validation remains outstanding.
Review follow-up
Removed the standalone native test files requested by review. Production changes are unchanged. The Python regression remains; native gtests need integration into cpp/tests/heimdall. Earlier isolated component checks are historical evidence only; full native integration and patched-extension acceptance remain unverified.