File tree Expand file tree Collapse file tree
vortex-array/src/aggregate_fn Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,6 +233,11 @@ impl<T: BinaryCombined> AggregateFnVTable for Combined<T> {
233233 BinaryCombined :: return_dtype ( & self . 0 , options, input_dtype)
234234 }
235235
236+ fn is_representation_invariant ( & self , options : & Self :: Options ) -> bool {
237+ self . 0 . left ( ) . is_representation_invariant ( & options. 0 )
238+ && self . 0 . right ( ) . is_representation_invariant ( & options. 1 )
239+ }
240+
236241 fn partial_dtype ( & self , options : & Self :: Options , input_dtype : & DType ) -> Option < DType > {
237242 let l = self . 0 . left ( ) . partial_dtype ( & options. 0 , input_dtype) ?;
238243 let r = self . 0 . right ( ) . partial_dtype ( & options. 1 , input_dtype) ?;
Original file line number Diff line number Diff line change @@ -88,6 +88,14 @@ impl AggregateFnRef {
8888 self . 0 . return_dtype ( input_dtype)
8989 }
9090
91+ /// Whether this bound function permits result reuse after an input representation change.
92+ ///
93+ /// See [`AggregateFnVTable::is_representation_invariant`] for the same input contract. Bound
94+ /// options remain part of the function identity; this does not permit reuse across options.
95+ pub fn is_representation_invariant ( & self ) -> bool {
96+ self . 0 . is_representation_invariant ( )
97+ }
98+
9199 /// Recover a partial scalar using [`AggregateFnVTable::partial_from_result`].
92100 ///
93101 /// `result` must describe this aggregate with its bound options over `input_dtype`. The returned
Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ impl AggregateFnVTable for Count {
3636 type Options = NumericalAggregateOpts ;
3737 type Partial = u64 ;
3838
39+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
40+ true
41+ }
42+
3943 fn id ( & self ) -> AggregateFnId {
4044 static ID : CachedId = CachedId :: new ( "vortex.count" ) ;
4145 * ID
Original file line number Diff line number Diff line change @@ -268,6 +268,10 @@ impl AggregateFnVTable for IsConstant {
268268 type Options = EmptyOptions ;
269269 type Partial = IsConstantPartial ;
270270
271+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
272+ true
273+ }
274+
271275 fn id ( & self ) -> AggregateFnId {
272276 static ID : CachedId = CachedId :: new ( "vortex.is_constant" ) ;
273277 * ID
Original file line number Diff line number Diff line change @@ -243,6 +243,10 @@ impl AggregateFnVTable for IsSorted {
243243 type Options = IsSortedOptions ;
244244 type Partial = IsSortedPartial ;
245245
246+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
247+ true
248+ }
249+
246250 fn id ( & self ) -> AggregateFnId {
247251 static ID : CachedId = CachedId :: new ( "vortex.is_sorted" ) ;
248252 * ID
Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ impl AggregateFnVTable for Max {
7575 type Options = NumericalAggregateOpts ;
7676 type Partial = MaxPartial ;
7777
78+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
79+ true
80+ }
81+
7882 fn id ( & self ) -> AggregateFnId {
7983 static ID : CachedId = CachedId :: new ( "vortex.max" ) ;
8084 * ID
Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ impl AggregateFnVTable for Min {
7575 type Options = NumericalAggregateOpts ;
7676 type Partial = MinPartial ;
7777
78+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
79+ true
80+ }
81+
7882 fn id ( & self ) -> AggregateFnId {
7983 static ID : CachedId = CachedId :: new ( "vortex.min" ) ;
8084 * ID
Original file line number Diff line number Diff line change @@ -294,6 +294,10 @@ impl AggregateFnVTable for MinMax {
294294 type Options = NumericalAggregateOpts ;
295295 type Partial = MinMaxPartial ;
296296
297+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
298+ true
299+ }
300+
297301 fn id ( & self ) -> AggregateFnId {
298302 static ID : CachedId = CachedId :: new ( "vortex.min_max" ) ;
299303 * ID
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ impl AggregateFnVTable for NanCount {
8585 type Options = EmptyOptions ;
8686 type Partial = u64 ;
8787
88+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
89+ true
90+ }
91+
8892 fn id ( & self ) -> AggregateFnId {
8993 static ID : CachedId = CachedId :: new ( "vortex.nan_count" ) ;
9094 * ID
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ impl AggregateFnVTable for NullCount {
6060 type Options = EmptyOptions ;
6161 type Partial = u64 ;
6262
63+ fn is_representation_invariant ( & self , _options : & Self :: Options ) -> bool {
64+ true
65+ }
66+
6367 fn id ( & self ) -> AggregateFnId {
6468 static ID : CachedId = CachedId :: new ( "vortex.null_count" ) ;
6569 * ID
You can’t perform that action at this time.
0 commit comments