| 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 { |