Skip to main content

negate_column

Function negate_column 

Source
fn negate_column<T>(column: Column<(Row, T, Diff)>) -> Column<(Row, T, Diff)>
where T: RenderTimestamp,
Expand description

Negates the diff of every record in column, rebuilding only the diff column.

A Typed input hands its row and time columns over untouched, so only the diffs are rebuilt, which is 8 bytes per record. A serialized input keeps all three columns in one buffer, so its rows and times are copied in bulk.

Negation stays checked: Neg for Overflowing runs overflowing_neg and reports overflow, which -Diff::MIN triggers.

TODO: Negate a Typed input’s diffs in place rather than rebuilding them. This cannot go through columnar::IndexMut: Overflows stores the raw integer and materializes Overflowing on read, so there is no wrapper in memory to borrow mutably, and handing out &mut to the raw integer would let writes bypass the checked arithmetic. It needs a checked bulk operation on the container instead, keeping the overflow check inside.