MCPcopy Create free account
hub / github.com/apache/datafusion / state

Method state

datafusion/ffi/src/udaf/accumulator.rs:298–315  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

296 }
297
298 fn state(&mut self) -> Result<Vec<ScalarValue>> {
299 unsafe {
300 let state_protos =
301 df_result!((self.accumulator.state)(&mut self.accumulator))?;
302
303 state_protos
304 .into_iter()
305 .map(|proto_bytes| {
306 datafusion_proto::protobuf::ScalarValue::decode(proto_bytes.as_ref())
307 .map_err(|e| DataFusionError::External(Box::new(e)))
308 .and_then(|proto_value| {
309 ScalarValue::try_from(&proto_value)
310 .map_err(DataFusionError::from)
311 })
312 })
313 .collect::<Result<Vec<_>>>()
314 }
315 }
316
317 fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
318 unsafe {

Calls 4

newFunction · 0.85
mapMethod · 0.45
into_iterMethod · 0.45
as_refMethod · 0.45