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.
§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. Component properties are sorted alphabetically by property name to produce a canonical identity for that unordered component set. A query with the same component set can then resolve to the index (if it exists) of an equivalent (multi-)property regardless of the order client code provides the component values.
§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 representative
property ID. This module provides the runtime registries
and reordering logic used by both the macro-generated code and the query engine.
Functions§
- register_
type_ ids_ to_ multi_ property_ id - Registers the representative multi-property ID for an unordered component set.
- 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_
inverse_ indices - Returns the inverse of a reordering produced by
static_sorted_indices. - 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_ id - Looks up the representative multi-property ID for a sorted list of component
TypeIds.