Skip to main content

Module drive_document_count_query

Module drive_document_count_query 

Source
Expand description

A query to count documents using CountTree elements Types and module structure for the GetDocumentsCount query.

The implementation is split across siblings:

  • [mode_detection] — operator classification + detect_mode.
  • [index_picker] — covering-index pickers (find_countable_index_*, find_range_countable_index_*).
  • [path_query] — the load-bearing prover/verifier-agreement path-query builders (aggregate_count_path_query, distinct_count_path_query, range_clause_to_query_item).
  • [execute_point_lookup] — Equal/In point-lookup execution (execute_no_proof, execute_with_proof).
  • [execute_range_count] — range-mode execution + RangeCountOptions.
  • [drive_dispatcher] — impl Drive per-mode dispatchers + DocumentCountRequest / DocumentCountResponse + execute_document_count_request.
  • [tests] (cfg server + test) — integration tests.

This file owns the three public types every other submodule references and the corresponding mod / pub use plumbing.

Re-exports§

pub use super::conditions::WhereOperator;
pub use crate::error::query::QuerySyntaxError;
pub use drive_dispatcher::DocumentCountRequest;
pub use drive_dispatcher::DocumentCountResponse;
pub use execute_range_count::RangeCountOptions;

Modules§

drive_dispatcher
Top-level dispatcher for the unified GetDocumentsCount request.
execute_point_lookup
Equal/In point-lookup execution paths for the count query.
execute_range_count
Range execution paths for the count query.
executors
Per-mode count-query executors on impl Drive. One file per super::DocumentCountMode variant — the dispatcher (super::drive_dispatcher) calls into the right one based on the detected mode.
index_picker
Index pickers for the count query.
mode_detection
Mode detection + operator classification for the count query.
path_query
Path-query builders for the count query.

Structs§

DriveDocumentCountQuery
A query to count documents using CountTree elements in the index path.
SplitCountEntry
An entry in a split count result, containing the serialized key(s) and the count of documents matching them.

Enums§

CountMode
SQL-shaped count-query mode — names the response shape the caller asked for via (select, group_by) on the wire.
DocumentCountMode
Classification of a count query’s shape, used to dispatch to the right executor. Returned by DriveDocumentCountQuery::detect_mode.

Constants§

MAX_CARRIER_AGGREGATE_OUTER_RANGE_LIMIT
Platform-wide maximum outer-walk cap for carrier-aggregate range-outer proofs (chapter 30 G8: outer_range_field > X AND inner_acor_field > Y with group_by = [outer_range_field] and prove = true).
MAX_LIMIT_AS_FAILSAFE
Hard cap on entries the count fan-out arms ask the executor to return.

Functions§

counter_sum_as_document_count
A summableOffCountIndex index’s sum read as a document count. A counter is never negative: it counts entries.
counter_sum_entry_as_count_entry
A sum entry read through DriveDocumentCountQuery::counter_sums_query, as the count entry it stands for.
document_count_chain_position
The position of the shallowest level of index whose value trees a count read may stop at, taking the subtree’s document count: the count chain’s ([Index::shallowest_count_chain_position]), or on a summableOffCountIndex index the sum chain’s, whose sums are its document counts. None without such a chain.
document_count_of_element
The number of documents an element a count read of index reaches stands for: its count, or, on a summableOffCountIndex index, its sum. Such an index keeps one counter per group, which counts one in its count trees and adds its group’s documents to their sums, and its registration rules make each counter equal its source group’s entries, so its sums are the document counts.
point_lookup_count_entries
Turns the (path, key, element) triples a point-lookup count path query yields (see point_lookup_count_path_query) into one entry per count tree. For compound (In) shapes the In value sits at path[base_path_len] when the walk descended past the base path (the In + trailing Equals shape) and IS the key otherwise (the In-on-terminator shape); Equal-only shapes have no per-key dimension. The element’s document count (document_count_of_element) is the per-branch count; an absent element becomes count: None. ONE decoder for every reader of that layout — the proof verifier, the no-proof executor and composite queries — so the layout has one owner.