|
18 | 18 | //! Accumulator module contains the trait definition for aggregation function's accumulators. |
19 | 19 |
|
20 | 20 | use arrow::array::ArrayRef; |
21 | | -use datafusion_common::{internal_err, Result, ScalarValue}; |
| 21 | +use datafusion_common::{internal_err, not_impl_err, Result, ScalarValue}; |
22 | 22 | use std::fmt::Debug; |
23 | 23 |
|
24 | 24 | /// Tracks an aggregate function's state. |
@@ -72,6 +72,23 @@ pub trait Accumulator: Send + Sync + Debug { |
72 | 72 | /// when possible (for example distinct strings) |
73 | 73 | fn evaluate(&mut self) -> Result<ScalarValue>; |
74 | 74 |
|
| 75 | + /// Cube: Like evaluate() but doesn't modify the accumulator. |
| 76 | + fn peek_evaluate(&self) -> Result<ScalarValue> { |
| 77 | + not_impl_err!("Accumulator::peek_evaluate not implemented for {}", std::any::type_name::<Self>()) |
| 78 | + } |
| 79 | + /// Cube: Resets the accumulator to its initial (zero-like) state. |
| 80 | + fn reset(&mut self) -> Result<()> { |
| 81 | + not_impl_err!("Accumulator::reset not implemented for {}", std::any::type_name::<Self>()) |
| 82 | + } |
| 83 | + /// Cube: Like state() but doesn't modify the accumulator. |
| 84 | + fn peek_state(&self) -> Result<Vec<ScalarValue>> { |
| 85 | + not_impl_err!("Accumulator::peek_state not implemented for {}", std::any::type_name::<Self>()) |
| 86 | + } |
| 87 | + /// Cube: true if this Accumulator supports these Cube accumulator functions. |
| 88 | + fn supports_cube_ext(&self) -> bool { |
| 89 | + false |
| 90 | + } |
| 91 | + |
75 | 92 | /// Returns the allocated size required for this accumulator, in |
76 | 93 | /// bytes, including `Self`. |
77 | 94 | /// |
|
0 commit comments