MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / index_dataflow

Function index_dataflow

src/clusterd-test-driver/src/dataflow.rs:457–480  ·  view source on GitHub ↗

Build a single-index dataflow over a persist shard. Thin sugar over [`DataflowBuilder`] for the common shape: import the collection backed by `shard` as `source_id`, set `as_of`, and export an index `index_id` arranging the collection by `key_cols`. `shard_upper` is the exclusive upper bound of the shard's written data; see [`PersistSource::upper`].

(
    source_id: GlobalId,
    index_id: GlobalId,
    shard: ShardId,
    location: PersistLocation,
    desc: RelationDesc,
    key_cols: Vec<usize>,
    as_of: Timestamp,
    shard_upper: Timestamp

Source from the content-addressed store, hash-verified

455/// `shard_upper` is the exclusive upper bound of the shard's written data; see
456/// [`PersistSource::upper`].
457pub fn index_dataflow(
458 source_id: GlobalId,
459 index_id: GlobalId,
460 shard: ShardId,
461 location: PersistLocation,
462 desc: RelationDesc,
463 key_cols: Vec<usize>,
464 as_of: Timestamp,
465 shard_upper: Timestamp,
466) -> anyhow::Result<DataflowDescription<RenderPlan, CollectionMetadata>> {
467 let mut builder = DataflowBuilder::new("headless-index");
468 builder.import_persist(
469 source_id,
470 PersistSource {
471 shard,
472 location,
473 desc,
474 upper: shard_upper,
475 },
476 );
477 builder.as_of(as_of);
478 builder.export_index(index_id, source_id, key_cols);
479 builder.finish()
480}
481
482/// Build a dataflow that counts the rows of an existing index and exports the
483/// count as a new, peekable index.

Callers 3

index_dataflow_structureFunction · 0.85
executeMethod · 0.85
index_over_small_shardFunction · 0.85

Calls 4

import_persistMethod · 0.80
as_ofMethod · 0.80
export_indexMethod · 0.45
finishMethod · 0.45

Tested by 1

index_over_small_shardFunction · 0.68