@@ -41,10 +41,10 @@ use crate::types::AccuracyTarget;
4141#[ serde( bound( serialize = "C: Serialize" , deserialize = "C: Deserialize<'de>" ) ) ]
4242pub enum AggIntent < C = ColumnId > {
4343 /// A reduction over paired values from two explicit input columns.
44- /// Operation semantics live in `BinaryAggOp `; both references participate
44+ /// Operation semantics live in `BivariateAggOp `; both references participate
4545 /// in binding and dependency tracking, unlike an opaque extension payload.
46- Binary {
47- op : BinaryAggOp ,
46+ Bivariate {
47+ op : BivariateAggOp ,
4848 left : C ,
4949 right : C ,
5050 } ,
@@ -292,7 +292,7 @@ pub enum AggIntent<C = ColumnId> {
292292/// must define their output type and exact/summary realization explicitly.
293293#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
294294#[ serde( rename_all = "snake_case" ) ]
295- pub enum BinaryAggOp {
295+ pub enum BivariateAggOp {
296296 /// Pearson correlation over pairs where both inputs are non-null.
297297 Correlation ,
298298}
@@ -489,12 +489,12 @@ impl<C: Clone> AggIntent<C> {
489489 /// An empty list retains the existing implicit sample/row-count convention.
490490 pub fn input_cols ( & self ) -> Vec < C > {
491491 match self {
492- Self :: Binary { left, right, .. } => vec ! [ left. clone( ) , right. clone( ) ] ,
492+ Self :: Bivariate { left, right, .. } => vec ! [ left. clone( ) , right. clone( ) ] ,
493493 _ => self . input_col ( ) . into_iter ( ) . collect ( ) ,
494494 }
495495 }
496496
497- /// The explicit input of a single-column reducer. Binary aggregates,
497+ /// The explicit input of a single-column reducer. Bivariate aggregates,
498498 /// argument-less aggregates, and implicit PromQL sample inputs return `None`.
499499 /// Use `input_cols` for dependency tracking; this accessor is for consumers
500500 /// that have already selected a single-column implementation.
@@ -529,8 +529,8 @@ impl<C: Clone> AggIntent<C> {
529529 AggIntent :: Avg { .. } => col ( "avg" , DataType :: Float64 , false ) ,
530530 AggIntent :: StdDev { .. } => col ( "stddev" , DataType :: Float64 , false ) ,
531531 AggIntent :: Variance { .. } => col ( "variance" , DataType :: Float64 , false ) ,
532- AggIntent :: Binary { op, .. } => match op {
533- BinaryAggOp :: Correlation => col ( "corr" , DataType :: Float64 , true ) ,
532+ AggIntent :: Bivariate { op, .. } => match op {
533+ BivariateAggOp :: Correlation => col ( "corr" , DataType :: Float64 , true ) ,
534534 } ,
535535 AggIntent :: Quantile { q, .. } => col (
536536 & format ! ( "quantile_{}" , quantile_suffix( * q) ) ,
@@ -656,20 +656,20 @@ pub mod topk {
656656
657657/// Two instances of this aggregation can be merged
658658/// (`agg(A ∪ B) = combine(agg(A), agg(B))`). `Avg` / `StdDev` / `Variance`
659- /// and binary correlation need richer partial state than a single value, so
659+ /// and correlation need richer partial state than a single value, so
660660/// their finalized values are not mergeable.
661661pub fn agg_is_mergeable ( op : & AggIntent ) -> bool {
662662 !matches ! (
663663 op,
664664 AggIntent :: Avg { .. }
665665 | AggIntent :: StdDev { .. }
666666 | AggIntent :: Variance { .. }
667- | AggIntent :: Binary { .. }
667+ | AggIntent :: Bivariate { .. }
668668 )
669669}
670670
671671/// Whether this op implies `exact_required` — no sketch benefit. The exact
672- /// intents include `Sum / Count / Avg / Min / Max` and binary correlation.
672+ /// intents include `Sum / Count / Avg / Min / Max` and correlation.
673673pub fn agg_is_exact ( op : & AggIntent ) -> bool {
674674 matches ! (
675675 op,
@@ -678,7 +678,7 @@ pub fn agg_is_exact(op: &AggIntent) -> bool {
678678 | AggIntent :: Avg { .. }
679679 | AggIntent :: Min { .. }
680680 | AggIntent :: Max { .. }
681- | AggIntent :: Binary { .. }
681+ | AggIntent :: Bivariate { .. }
682682 | AggIntent :: Group
683683 | AggIntent :: CountValues { .. }
684684 )
@@ -735,9 +735,9 @@ mod tests {
735735
736736 // Paired aggregates expose both dependencies but cannot merge final scalar results.
737737 #[ test]
738- fn binary_aggregate_contract ( ) {
739- let intent = AggIntent :: Binary {
740- op : BinaryAggOp :: Correlation ,
738+ fn bivariate_aggregate_contract ( ) {
739+ let intent = AggIntent :: Bivariate {
740+ op : BivariateAggOp :: Correlation ,
741741 left : 2 ,
742742 right : 5 ,
743743 } ;
@@ -749,7 +749,7 @@ mod tests {
749749 assert_eq ! ( output. dtype, DataType :: Float64 ) ;
750750 assert ! ( output. nullable) ;
751751 let value = serde_json:: to_value ( & intent) . unwrap ( ) ;
752- assert_eq ! ( value[ "kind" ] , "binary " ) ;
752+ assert_eq ! ( value[ "kind" ] , "bivariate " ) ;
753753 assert_eq ! ( value[ "op" ] , "correlation" ) ;
754754 assert_eq ! ( serde_json:: from_value:: <AggIntent >( value) . unwrap( ) , intent) ;
755755 }
0 commit comments