feat(index): add zone map support for all data types - #8017
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
wjones127
left a comment
There was a problem hiding this comment.
Looks good! Just a minor nitpick on the code, though looks like there's a python test failure that seems legit.
| min: ScalarValue::try_from(&self.data_type) | ||
| .map_err(|e| Error::invalid_input(format!("{e}")))?, | ||
| max: ScalarValue::try_from(&self.data_type) | ||
| .map_err(|e| Error::invalid_input(format!("{e}")))?, |
There was a problem hiding this comment.
nitpick: this is a non-obvious way to construct a null. Perhaps would be more clear as a ScalarValue::try_new_null()
There was a problem hiding this comment.
Yes, great idea, I've switched to this.
9216a4d to
938635c
Compare
Adds per-position min/max statistics for FixedSizeList columns so the zone map can prune zones during equality queries on fixed-size list (e.g. embedding vector) columns. Key changes: - New `FixedSizeListZoneAccumulator` tracks per-position min/max as `Vec<Option<ScalarValue>>` across all non-null list entries in a zone. - `ZoneMapProcessor` dispatches through a new `ZoneMapAccumulator` enum that selects between scalar and FSL accumulators based on the column type. - `evaluate_fsl_equals` performs per-position range checks: a zone is pruned when any element of the query list falls outside `[min[j], max[j]]`. - `Equals` and `IsIn` queries delegate to `evaluate_fsl_equals` for FSL targets; `Range` and `LikePrefix` conservatively return true. - `value_range` / `value_range_over` return `None` for FSL zones. - The `is_nested()` guard in `new_training_request` and `create_seed_writer` is lifted for `FixedSizeList<non-nested>` types. - `default_use_seeds` returns true for all `FixedSizeList` columns. - Six new tests cover pruning, null lists, IsIn, NaN elements, all-null zones, and value_range behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the per-position FixedSizeList accumulator with a simpler design: all nested types (List, LargeList, FixedSizeList, Struct, Map, etc.) are now supported, tracking only null_count and null bitmap — min/max are stored as typed null ScalarValues. For non-nested types, behavior is unchanged. For nested types, query evaluation prunes only when null_count equals the zone length (all rows null) or when checking IsNull/null equality; all other queries conserve. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ments - Restore deleted comment in Equals handler and simplify comments in value_range/value_range_over/default_use_seeds per PR review - Add test_zonemap_fsl_column: verifies zone map creation on a FixedSizeList column and that IS NULL is ScalarIndex-accelerated - Add test_vector_and_zonemap_on_fsl_column: verifies vector index (IVF_PQ) and zone map can coexist on the same FSL column, with vector search and IS NULL both working correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…idation The Python-level type guard for create_scalar_index incorrectly rejected FixedSizeList and other nested types for ZONEMAP indexes. Split the BTREE/ BITMAP check from the ZONEMAP check and add pa.types.is_nested() as an accepted type for ZONEMAP. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ZONEMAP works on any column type at the Rust level (nested types get null-only tracking, everything else gets min/max). Remove the Python whitelist entirely instead of extending it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scalar_index_info filtered out all FixedSizeList columns using is_vector_field(), which classifies any FSL type as a vector column. Now that zone maps can be created on FSL columns, this caused the zone map to be invisible to the query planner and IS NULL / other queries on FSL columns never used the scalar index. Remove the is_vector_field() pre-filter from the outer loop; the inner index_details.is_vector() check already correctly skips true vector indexes based on index type, not column type. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
938635c to
aefbbba
Compare
|
I have a PR to implement the zonemap for all data types as well. Will take a look whether I can merge something |
|
I compared this merged implementation with #8190. This PR covers the core nested-type enablement and also includes important Python/planner fixes that #8190 should preserve. There are still a few useful follow-ups in #8190:
I’ll rebase #8190 onto this merge and narrow it to these incremental pieces, retaining this PR’s Python validation, FSL scalar-index discovery, and scalar/vector coexistence fixes. |
We are using zonemap as our "statistics" and it is also important for recording nullability bitmaps. As a result, we need it to support all types. For nested types we don't track the min/max but we still track the nullability bitmap and the null count (we could track more things in the future)