Skip to main content

count_over_index

Function count_over_index 

Source
pub fn count_over_index(
    index_id: GlobalId,
    on_id: GlobalId,
    on_type: ReprRelationType,
    key_cols: Vec<usize>,
    reduce_id: GlobalId,
    out_index_id: GlobalId,
    as_of: Timestamp,
) -> Result<DataflowDescription<RenderPlan, CollectionMetadata>>
Expand description

Build a dataflow that counts the rows of an existing index and exports the count as a new, peekable index.

Imports index index_id (arranging on_id, schema on_type, key key_cols), computes Reduce with a single count(*) aggregate and an empty group key over Get(on_id), and exports out_index_id arranging the one-column count by [0]. This is the compute-side realization of a row-count assertion: the count runs through a real reduce operator rather than being tallied in the driver.

The result collection has one bigint column. Over an empty input the reduce emits no rows (SQL’s default-zero is added higher up), so a peek of the output yields [], which callers read as a count of 0.