MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / append_null_fill

Function append_null_fill

nodedb-columnar/src/reader/block_decode.rs:85–122  ·  view source on GitHub ↗

Append null-fill rows for a skipped block.

(result: &mut DecodedColumn, row_count: usize)

Source from the content-addressed store, hash-verified

83
84/// Append null-fill rows for a skipped block.
85pub(super) fn append_null_fill(result: &mut DecodedColumn, row_count: usize) {
86 match result {
87 DecodedColumn::Int64 { values, valid } => {
88 values.extend(std::iter::repeat_n(0i64, row_count));
89 valid.extend(std::iter::repeat_n(false, row_count));
90 }
91 DecodedColumn::Float64 { values, valid } => {
92 values.extend(std::iter::repeat_n(0.0f64, row_count));
93 valid.extend(std::iter::repeat_n(false, row_count));
94 }
95 DecodedColumn::Timestamp { values, valid } => {
96 values.extend(std::iter::repeat_n(0i64, row_count));
97 valid.extend(std::iter::repeat_n(false, row_count));
98 }
99 DecodedColumn::Bool { values, valid } => {
100 values.extend(std::iter::repeat_n(false, row_count));
101 valid.extend(std::iter::repeat_n(false, row_count));
102 }
103 DecodedColumn::Binary {
104 data: _,
105 offsets,
106 valid,
107 } => {
108 let last = *offsets.last().unwrap_or(&0);
109 // For null-fill: each null row has zero-length data.
110 // Need row_count + 1 offsets if this is the first block, else row_count.
111 if offsets.is_empty() {
112 offsets.push(last); // Initial sentinel for first block.
113 }
114 offsets.extend(std::iter::repeat_n(last, row_count));
115 valid.extend(std::iter::repeat_n(false, row_count));
116 }
117 DecodedColumn::DictEncoded { ids, valid, .. } => {
118 ids.extend(std::iter::repeat_n(0u32, row_count));
119 valid.extend(std::iter::repeat_n(false, row_count));
120 }
121 }
122}
123
124/// Get the current length of the validity vector in a DecodedColumn.
125pub(super) fn result_valid_len(result: &DecodedColumn) -> usize {

Callers 2

read_column_implMethod · 0.85
decode_blockFunction · 0.85

Calls 4

extendMethod · 0.45
lastMethod · 0.45
is_emptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected