From 86278d0871eb9f318de5481f9b51ae539c31c546 Mon Sep 17 00:00:00 2001 From: Mihai Budiu Date: Mon, 22 Jun 2026 15:45:17 -0700 Subject: [PATCH 1/3] [DBSP] Add DBSP operator integral_weight_validator which checks whether an internal collection ever has negative weights and panics Signed-off-by: Mihai Budiu --- crates/dbsp/src/operator.rs | 1 + .../src/operator/integral_weight_validator.rs | 152 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 crates/dbsp/src/operator/integral_weight_validator.rs diff --git a/crates/dbsp/src/operator.rs b/crates/dbsp/src/operator.rs index dc7f013f15c..19ff96d359a 100644 --- a/crates/dbsp/src/operator.rs +++ b/crates/dbsp/src/operator.rs @@ -22,6 +22,7 @@ mod csv; mod delta0; mod differentiate; mod generator; +mod integral_weight_validator; mod integrate; mod neg; mod output; diff --git a/crates/dbsp/src/operator/integral_weight_validator.rs b/crates/dbsp/src/operator/integral_weight_validator.rs new file mode 100644 index 00000000000..d97a2b5d619 --- /dev/null +++ b/crates/dbsp/src/operator/integral_weight_validator.rs @@ -0,0 +1,152 @@ +//! Integral operator that panics when any record's accumulated weight +//! becomes negative. + +use crate::{ + NumEntries, ZWeight, + algebra::{AddAssignByRef, AddByRef, HasZero}, + circuit::{Circuit, Stream, checkpointer::Checkpoint}, + dynamic::Erase, + trace::{BatchReader as TraceBatchReader, Cursor as TraceCursor}, + typed_batch::{Batch, IndexedZSetReader}, +}; +use size_of::SizeOf; + +impl Stream +where + C: Circuit, + B: Checkpoint + + AddByRef + + AddAssignByRef + + Clone + + Eq + + HasZero + + SizeOf + + NumEntries + + IndexedZSetReader + + Batch