Expand description
Utilities for managing and querying multi-properties.
A multi-property is a derived property composed of a tuple of other properties. They are primarily used to enable joint indexing and efficient multi-column style queries.
§Indexing and Normalization
To ensure that queries can efficiently find matching indexes, multi-properties that consist of the same set of component properties are considered equivalent, regardless of their definition order. The system achieves this by:
- Canonicalization: Component properties are sorted based on their unique identifiers.
- Shared Indexes: The index subsystem reuses a single
Indexinstance for all multi-properties that are equivalent up to reordering.
§Query Integration
The querying subsystem uses the utilities in this module to detect when a query involving multiple individual properties can be satisfied by an existing multi-property index. If a match is found, the query can perform a fast index lookup instead of iterating over component properties.
§Implementation Details
Multi-properties are defined using the define_multi_property! macro, which
handles the registration and mapping between the property set and its canonical
index ID. This module provides the runtime registry (MULTI_PROPERTY_INDEX_MAP)
and reordering logic used by both the macro-generated code and the query engine.
Functions§
- register_
type_ ids_ to_ multi_ property_ index - A method that registers the index ID of the multi-property tuple type that has the given
list of
TypeIds as its properties. - static_
apply_ reordering - Reorders the
valuesin place according to the ordering defined byindices. Theindicesis an ordering produced bysorted_indices/static_sorted_indicesand encodes the sorted order of thekeys(the names of the tag types). - static_
reorder_ by_ keys - Reorder
valuesin place according to the sorted order ofkeys. - static_
sorted_ indices - Returns the indices of
keysin sorted order. These indices are used to reorder some other array according to the sorted order of thekeys, e.g. bystatic_apply_reordering. - type_
ids_ to_ multi_ property_ index - A method that looks up the index ID of the multi-property that has the given
list of
TypeIds as its properties.