MCPcopy Create free account
hub / github.com/apache/arrow-rs / next_back

Method next_back

arrow-array/src/run_iterator.rs:129–160  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

127 <&'a V as ArrayAccessor>::Item: Default,
128{
129 fn next_back(&mut self) -> Option<Self::Item> {
130 if self.current_back_logical == self.current_front_logical {
131 return None;
132 }
133
134 self.current_back_logical -= 1;
135
136 let run_ends = self.array.run_ends().values();
137 if self.current_back_physical > 0
138 && self.current_back_logical < run_ends[self.current_back_physical - 1].as_usize()
139 {
140 // As the run_ends is expected to be strictly increasing, there
141 // should be at least one logical entry in one physical entry. Because of this
142 // reason the next value can be accessed by decrementing physical index once.
143 self.current_back_physical -= 1;
144 }
145 Some(if self.array.values().is_null(self.current_back_physical) {
146 None
147 } else {
148 // Safety:
149 // The check `self.current_end_physical > 0` ensures the value will not underflow.
150 // Also self.current_end_physical starts with array.len() and
151 // decrements based on the bounds of self.current_end_logical.
152 unsafe {
153 Some(
154 self.array
155 .values()
156 .value_unchecked(self.current_back_physical),
157 )
158 }
159 })
160 }
161}
162
163/// all arrays have known size.

Callers

nothing calls this directly

Calls 5

run_endsMethod · 0.80
as_usizeMethod · 0.80
valuesMethod · 0.45
is_nullMethod · 0.45
value_uncheckedMethod · 0.45

Tested by

no test coverage detected