@@ -283,6 +283,10 @@ pub enum MetricValue {
283283/// classical defintion of "cpu_time", which is the time reported 
284284/// from `clock_gettime(CLOCK_THREAD_CPUTIME_ID, ..)`. 
285285ElapsedCompute ( Time ) , 
286+     /// Number of spills produced: "spill_count" metric 
287+ SpillCount ( Count ) , 
288+     /// Total size of spilled bytes produced: "spilled_bytes" metric 
289+ SpilledBytes ( Count ) , 
286290    /// Operator defined count. 
287291Count  { 
288292        /// The provided name of this metric 
@@ -308,6 +312,8 @@ impl MetricValue {
308312pub  fn  name ( & self )  -> & str  { 
309313        match  self  { 
310314            Self :: OutputRows ( _)  => "output_rows" , 
315+             Self :: SpillCount ( _)  => "spill_count" , 
316+             Self :: SpilledBytes ( _)  => "spilled_bytes" , 
311317            Self :: ElapsedCompute ( _)  => "elapsed_compute" , 
312318            Self :: Count  {  name,  .. }  => name. borrow ( ) , 
313319            Self :: Time  {  name,  .. }  => name. borrow ( ) , 
@@ -320,6 +326,8 @@ impl MetricValue {
320326pub  fn  as_usize ( & self )  -> usize  { 
321327        match  self  { 
322328            Self :: OutputRows ( count)  => count. value ( ) , 
329+             Self :: SpillCount ( count)  => count. value ( ) , 
330+             Self :: SpilledBytes ( bytes)  => bytes. value ( ) , 
323331            Self :: ElapsedCompute ( time)  => time. value ( ) , 
324332            Self :: Count  {  count,  .. }  => count. value ( ) , 
325333            Self :: Time  {  time,  .. }  => time. value ( ) , 
@@ -339,6 +347,8 @@ impl MetricValue {
339347pub  fn  new_empty ( & self )  -> Self  { 
340348        match  self  { 
341349            Self :: OutputRows ( _)  => Self :: OutputRows ( Count :: new ( ) ) , 
350+             Self :: SpillCount ( _)  => Self :: SpillCount ( Count :: new ( ) ) , 
351+             Self :: SpilledBytes ( _)  => Self :: SpilledBytes ( Count :: new ( ) ) , 
342352            Self :: ElapsedCompute ( _)  => Self :: ElapsedCompute ( Time :: new ( ) ) , 
343353            Self :: Count  {  name,  .. }  => Self :: Count  { 
344354                name :  name. clone ( ) , 
@@ -365,6 +375,8 @@ impl MetricValue {
365375pub  fn  aggregate ( & mut  self ,  other :  & Self )  { 
366376        match  ( self ,  other)  { 
367377            ( Self :: OutputRows ( count) ,  Self :: OutputRows ( other_count) ) 
378+             | ( Self :: SpillCount ( count) ,  Self :: SpillCount ( other_count) ) 
379+             | ( Self :: SpilledBytes ( count) ,  Self :: SpilledBytes ( other_count) ) 
368380            | ( 
369381                Self :: Count  {  count,  .. } , 
370382                Self :: Count  { 
@@ -401,10 +413,12 @@ impl MetricValue {
401413        match  self  { 
402414            Self :: OutputRows ( _)  => 0 ,      // show first 
403415            Self :: ElapsedCompute ( _)  => 1 ,  // show second 
404-             Self :: Count  {  .. }  => 2 , 
405-             Self :: Time  {  .. }  => 3 , 
406-             Self :: StartTimestamp ( _)  => 4 ,  // show timestamps last 
407-             Self :: EndTimestamp ( _)  => 5 , 
416+             Self :: SpillCount ( _)  => 2 , 
417+             Self :: SpilledBytes ( _)  => 3 , 
418+             Self :: Count  {  .. }  => 4 , 
419+             Self :: Time  {  .. }  => 5 , 
420+             Self :: StartTimestamp ( _)  => 6 ,  // show timestamps last 
421+             Self :: EndTimestamp ( _)  => 7 , 
408422        } 
409423    } 
410424
@@ -418,7 +432,10 @@ impl std::fmt::Display for MetricValue {
418432    /// Prints the value of this metric 
419433fn  fmt ( & self ,  f :  & mut  std:: fmt:: Formatter )  -> std:: fmt:: Result  { 
420434        match  self  { 
421-             Self :: OutputRows ( count)  | Self :: Count  {  count,  .. }  => { 
435+             Self :: OutputRows ( count) 
436+             | Self :: SpillCount ( count) 
437+             | Self :: SpilledBytes ( count) 
438+             | Self :: Count  {  count,  .. }  => { 
422439                write ! ( f,  "{}" ,  count) 
423440            } 
424441            Self :: ElapsedCompute ( time)  | Self :: Time  {  time,  .. }  => { 
0 commit comments