@@ -35,6 +35,8 @@ use arrow::error::Result as ArrowResult;
3535use  arrow:: record_batch:: RecordBatch ; 
3636use  arrow:: { array:: ArrayRef ,  datatypes:: Field } ; 
3737use  async_trait:: async_trait; 
38+ pub  use  datafusion_expr:: Accumulator ; 
39+ pub  use  datafusion_expr:: ColumnarValue ; 
3840pub  use  display:: DisplayFormatType ; 
3941use  futures:: stream:: Stream ; 
4042use  std:: fmt; 
@@ -419,32 +421,6 @@ pub enum Distribution {
419421HashPartitioned ( Vec < Arc < dyn  PhysicalExpr > > ) , 
420422} 
421423
422- /// Represents the result from an expression 
423- #[ derive( Clone ) ]  
424- pub  enum  ColumnarValue  { 
425-     /// Array of values 
426- Array ( ArrayRef ) , 
427-     /// A single value 
428- Scalar ( ScalarValue ) , 
429- } 
430- 
431- impl  ColumnarValue  { 
432-     fn  data_type ( & self )  -> DataType  { 
433-         match  self  { 
434-             ColumnarValue :: Array ( array_value)  => array_value. data_type ( ) . clone ( ) , 
435-             ColumnarValue :: Scalar ( scalar_value)  => scalar_value. get_datatype ( ) , 
436-         } 
437-     } 
438- 
439-     /// Convert a columnar value into an ArrayRef 
440- pub  fn  into_array ( self ,  num_rows :  usize )  -> ArrayRef  { 
441-         match  self  { 
442-             ColumnarValue :: Array ( array)  => array, 
443-             ColumnarValue :: Scalar ( scalar)  => scalar. to_array_of_size ( num_rows) , 
444-         } 
445-     } 
446- } 
447- 
448424/// Expression that can be evaluated against a RecordBatch 
449425/// A Physical expression knows its type, nullability and how to evaluate itself. 
450426pub  trait  PhysicalExpr :  Send  + Sync  + Display  + Debug  { 
@@ -578,30 +554,6 @@ pub trait WindowExpr: Send + Sync + Debug {
578554    } 
579555} 
580556
581- /// An accumulator represents a stateful object that lives throughout the evaluation of multiple rows and 
582- /// generically accumulates values. 
583- /// 
584- /// An accumulator knows how to: 
585- /// * update its state from inputs via `update_batch` 
586- /// * convert its internal state to a vector of scalar values 
587- /// * update its state from multiple accumulators' states via `merge_batch` 
588- /// * compute the final value from its internal state via `evaluate` 
589- pub  trait  Accumulator :  Send  + Sync  + Debug  { 
590-     /// Returns the state of the accumulator at the end of the accumulation. 
591- // in the case of an average on which we track `sum` and `n`, this function should return a vector 
592-     // of two values, sum and n. 
593-     fn  state ( & self )  -> Result < Vec < ScalarValue > > ; 
594- 
595-     /// updates the accumulator's state from a vector of arrays. 
596- fn  update_batch ( & mut  self ,  values :  & [ ArrayRef ] )  -> Result < ( ) > ; 
597- 
598-     /// updates the accumulator's state from a vector of states. 
599- fn  merge_batch ( & mut  self ,  states :  & [ ArrayRef ] )  -> Result < ( ) > ; 
600- 
601-     /// returns its value based on its current state. 
602- fn  evaluate ( & self )  -> Result < ScalarValue > ; 
603- } 
604- 
605557/// Applies an optional projection to a [`SchemaRef`], returning the 
606558/// projected schema 
607559/// 
0 commit comments