Skip to main content

Module index_picker

Module index_picker 

Source
Expand description

Sum-index pickers. Parallels count’s index_picker.rs.

Two pickers:

  • find_summable_index_for_where_clauses: returns the index whose summed value equals the request’s sum_property and whose properties the Equal/In where-clause fields exactly match, or, on a summableOffCountIndex index, cover as a prefix it can read whole: a prefix reaching its sum chain (the deepest pin’s value tree) or every property but the last (the last property’s tree). None on miss.
  • find_range_summable_index_for_where_clauses: returns the rangeSummable: true index whose Equal/In prefix covers the non-range clauses AND whose last property is the range terminator. None on miss.

Reject-on-miss is the load-bearing contract: callers landing in “no covering index” return WhereClauseOnNonIndexedProperty so the prover and verifier reject the same set of inputs (same as count).

Functions§

find_range_summable_index_for_where_clauses
Find a rangeSummable: true index whose properties cover the non-range Equal/In clauses as a prefix AND whose last property is the range terminator. The summed property must match sum_property.
find_range_summable_index_with_counts_for_where_clauses
find_range_summable_index_for_where_clauses for a range average or count-and-sum read: the picked index must also be rangeCountable. A summableOffCountIndex index that is not is passed over, so it never hides, by name order, one that is. A regular index is picked first and judged after, as before protocol version 14, so a query over regular indexes keeps resolving to the index released verifiers rebuild.
find_summable_index_for_where_clauses
Find an index whose summed value equals the request’s sum_property and whose properties the Equal/In where-clause fields exactly cover, or, on a summableOffCountIndex index, cover as a prefix it reads whole (see find_summable_index_accepted_by).
find_summable_index_with_counts_for_where_clauses
find_summable_index_for_where_clauses for an average or count-and-sum read: the picked index’s read element must also carry a count ([summable_point_lookup_carries_counts]). A summableOffCountIndex index that cannot answer is passed over, so it never hides, by name order, one that can. A regular index is picked first and judged after, as before protocol version 14, so a query over regular indexes keeps resolving to the index released verifiers rebuild.