Skip to content

Commit 1bde354

Browse files
antiguruclaude
andcommitted
doc: tighten the columnar TopK-output comments
State the injectivity that lets the builder skip consolidation and drop the test doc that repeats the function's own contract. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d574472 commit 1bde354

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

‎src/compute/src/render/top_k.rs‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -661,18 +661,15 @@ where
661661
}
662662
}
663663

664-
/// Drops the hash-key pairing from a consolidated `(hash_key, row)` TopK result,
665-
/// producing the columnar output edge.
664+
/// Drops the hash-key pairing from a consolidated `(hash_key, row)` TopK result.
666665
///
667-
/// The input is consolidated upstream and the hash key is a function of the row,
668-
/// so distinct `(hash_key, row)` entries have distinct rows. Dropping the key is
669-
/// therefore injective and the output carries no within-batch duplicates, so a
670-
/// non-consolidating `ColumnBuilder` matches the prior `map`. The row is pushed
671-
/// borrowed, materializing no owned `Row` per record.
666+
/// The hash key is a function of the row and the input is consolidated, so dropping the
667+
/// key is injective and the output has no within-batch duplicates for a consolidating
668+
/// builder to fold. Rows are pushed borrowed.
672669
///
673-
/// TODO: TopK renders its stages over `Vec` containers, so this encode sits at
674-
/// the very end of the plan. Pushing columnar containers down through
675-
/// `build_topk` and the monotonic path would remove it.
670+
/// TODO: TopK renders its stages over `Vec` containers, so this encode sits at the very
671+
/// end of the plan. Pushing columnar containers down through `build_topk` and the
672+
/// monotonic path would remove it.
676673
fn topk_result_to_columnar<'s, T>(
677674
collection: VecCollection<'s, T, (Row, Row), Diff>,
678675
) -> CollectionEdge<'s, T>
@@ -1360,10 +1357,6 @@ mod tests {
13601357
}
13611358
}
13621359

1363-
/// `topk_result_to_columnar` drops the hash-key pairing and produces a
1364-
/// columnar edge whose rows are the value component, preserving times and
1365-
/// diffs. This produces the columnar output for the monotonic and basic TopK
1366-
/// plans.
13671360
#[mz_ore::test]
13681361
fn topk_result_to_columnar_drops_key() {
13691362
let key = Row::pack_slice(&[Datum::Int64(7)]);
@@ -1378,9 +1371,8 @@ mod tests {
13781371
1u64,
13791372
Diff::ONE,
13801373
),
1381-
// Retracts at a `(row, time)` with no insertion, so it survives the
1382-
// `InputSession`'s pre-send consolidation and exercises a borrowed
1383-
// negative diff.
1374+
// Retracts at a `(row, time)` with no insertion, so the `InputSession`'s
1375+
// pre-send consolidation does not cancel it out.
13841376
(
13851377
(key.clone(), Row::pack_slice(&[Datum::Int32(1)])),
13861378
2u64,

0 commit comments

Comments
 (0)