Enum mz_expr::AggregateFunc
source · pub enum AggregateFunc {
Show 62 variants
MaxNumeric,
MaxInt16,
MaxInt32,
MaxInt64,
MaxUInt16,
MaxUInt32,
MaxUInt64,
MaxMzTimestamp,
MaxFloat32,
MaxFloat64,
MaxBool,
MaxString,
MaxDate,
MaxTimestamp,
MaxTimestampTz,
MaxInterval,
MaxTime,
MinNumeric,
MinInt16,
MinInt32,
MinInt64,
MinUInt16,
MinUInt32,
MinUInt64,
MinMzTimestamp,
MinFloat32,
MinFloat64,
MinBool,
MinString,
MinDate,
MinTimestamp,
MinTimestampTz,
MinInterval,
MinTime,
SumInt16,
SumInt32,
SumInt64,
SumUInt16,
SumUInt32,
SumUInt64,
SumFloat32,
SumFloat64,
SumNumeric,
Count,
Any,
All,
JsonbAgg {
order_by: Vec<ColumnOrder>,
},
JsonbObjectAgg {
order_by: Vec<ColumnOrder>,
},
MapAgg {
order_by: Vec<ColumnOrder>,
value_type: ScalarType,
},
ArrayConcat {
order_by: Vec<ColumnOrder>,
},
ListConcat {
order_by: Vec<ColumnOrder>,
},
StringAgg {
order_by: Vec<ColumnOrder>,
},
RowNumber {
order_by: Vec<ColumnOrder>,
},
Rank {
order_by: Vec<ColumnOrder>,
},
DenseRank {
order_by: Vec<ColumnOrder>,
},
LagLead {
order_by: Vec<ColumnOrder>,
lag_lead: LagLeadType,
ignore_nulls: bool,
},
FirstValue {
order_by: Vec<ColumnOrder>,
window_frame: WindowFrame,
},
LastValue {
order_by: Vec<ColumnOrder>,
window_frame: WindowFrame,
},
FusedValueWindowFunc {
funcs: Vec<AggregateFunc>,
order_by: Vec<ColumnOrder>,
},
WindowAggregate {
wrapped_aggregate: Box<AggregateFunc>,
order_by: Vec<ColumnOrder>,
window_frame: WindowFrame,
},
FusedWindowAggregate {
wrapped_aggregates: Vec<AggregateFunc>,
order_by: Vec<ColumnOrder>,
window_frame: WindowFrame,
},
Dummy,
}
Variants§
MaxNumeric
MaxInt16
MaxInt32
MaxInt64
MaxUInt16
MaxUInt32
MaxUInt64
MaxMzTimestamp
MaxFloat32
MaxFloat64
MaxBool
MaxString
MaxDate
MaxTimestamp
MaxTimestampTz
MaxInterval
MaxTime
MinNumeric
MinInt16
MinInt32
MinInt64
MinUInt16
MinUInt32
MinUInt64
MinMzTimestamp
MinFloat32
MinFloat64
MinBool
MinString
MinDate
MinTimestamp
MinTimestampTz
MinInterval
MinTime
SumInt16
SumInt32
SumInt64
SumUInt16
SumUInt32
SumUInt64
SumFloat32
SumFloat64
SumNumeric
Count
Any
All
JsonbAgg
Accumulates Datum::List
s whose first element is a JSON-typed Datum
s
into a JSON list. The other elements are columns used by order_by
.
WARNING: Unlike the jsonb_agg
function that is exposed by the SQL
layer, this function filters out Datum::Null
, for consistency with
the other aggregate functions.
Fields
order_by: Vec<ColumnOrder>
JsonbObjectAgg
Zips Datum::List
s whose first element is a JSON-typed Datum
s into a
JSON map. The other elements are columns used by order_by
.
WARNING: Unlike the jsonb_object_agg
function that is exposed by the SQL
layer, this function filters out Datum::Null
, for consistency with
the other aggregate functions.
Fields
order_by: Vec<ColumnOrder>
MapAgg
Zips a Datum::List
whose first element is a Datum::List
guaranteed
to be non-empty and whose len % 2 == 0 into a Datum::Map
. The other
elements are columns used by order_by
.
ArrayConcat
Accumulates Datum::Array
s of ScalarType::Record
whose first element is a Datum::Array
into a single Datum::Array
(the remaining fields are used by order_by
).
Fields
order_by: Vec<ColumnOrder>
ListConcat
Accumulates Datum::List
s of ScalarType::Record
whose first field is a Datum::List
into a single Datum::List
(the remaining fields are used by order_by
).
Fields
order_by: Vec<ColumnOrder>
StringAgg
Fields
order_by: Vec<ColumnOrder>
RowNumber
Fields
order_by: Vec<ColumnOrder>
Rank
Fields
order_by: Vec<ColumnOrder>
DenseRank
Fields
order_by: Vec<ColumnOrder>
LagLead
FirstValue
LastValue
FusedValueWindowFunc
Several value window functions fused into one function, to amortize overheads.
Fields
funcs: Vec<AggregateFunc>
order_by: Vec<ColumnOrder>
Currently, all the fused functions must have the same order_by
. (We can later
eliminate this limitation.)
WindowAggregate
FusedWindowAggregate
Dummy
Accumulates any number of Datum::Dummy
s into Datum::Dummy
.
Useful for removing an expensive aggregation while maintaining the shape of a reduce operator.
Implementations§
source§impl AggregateFunc
impl AggregateFunc
pub fn eval<'a, I>(&self, datums: I, temp_storage: &'a RowArena) -> Datum<'a>where
I: IntoIterator<Item = Datum<'a>>,
sourcepub fn eval_with_fast_window_agg<'a, I, W>(
&self,
datums: I,
temp_storage: &'a RowArena,
) -> Datum<'a>
pub fn eval_with_fast_window_agg<'a, I, W>( &self, datums: I, temp_storage: &'a RowArena, ) -> Datum<'a>
Like eval
, but it’s given a OneByOneAggr. If self
is a WindowAggregate
, then
the given OneByOneAggr will be used to evaluate the wrapped aggregate inside the
WindowAggregate
. If self
is not a WindowAggregate
, then it simply calls eval
.
pub fn eval_with_unnest_list<'a, I, W>( &self, datums: I, temp_storage: &'a RowArena, ) -> impl Iterator<Item = Datum<'a>>
sourcepub fn default(&self) -> Datum<'static>
pub fn default(&self) -> Datum<'static>
Returns the output of the aggregation function when applied on an empty input relation.
sourcepub fn identity_datum(&self) -> Datum<'static>
pub fn identity_datum(&self) -> Datum<'static>
Returns a datum whose inclusion in the aggregation will not change its result.
pub fn can_fuse_with_unnest_list(&self) -> bool
sourcepub fn output_type(&self, input_type: ColumnType) -> ColumnType
pub fn output_type(&self, input_type: ColumnType) -> ColumnType
The output column type for the result of an aggregation.
The output column type also contains nullability information, which is (without further information) true for aggregations that are not counts.
sourcefn output_type_ranking_window_funcs(
input_type: &ColumnType,
col_name: &str,
) -> ScalarType
fn output_type_ranking_window_funcs( input_type: &ColumnType, col_name: &str, ) -> ScalarType
Compute output type for ROW_NUMBER, RANK, DENSE_RANK
sourcefn lag_lead_output_type_inner_from_encoded_args(
encoded_args_type: &ScalarType,
) -> ColumnType
fn lag_lead_output_type_inner_from_encoded_args( encoded_args_type: &ScalarType, ) -> ColumnType
Given the EncodedArgs
part of ((OriginalRow, EncodedArgs), OrderByExprs...)
,
this computes the type of the first field of the output type. (The first field is the
real result, the rest is the original row.)
fn lag_lead_result_column_name(lag_lead_type: &LagLeadType) -> ColumnName
sourcepub fn propagates_nonnull_constraint(&self) -> bool
pub fn propagates_nonnull_constraint(&self) -> bool
Returns true if the non-null constraint on the aggregation can be converted into a non-null constraint on its parameter expression, ie. whether the result of the aggregation is null if all the input values are null.
Trait Implementations§
source§impl Arbitrary for AggregateFunc
impl Arbitrary for AggregateFunc
An explicit Arbitrary
implementation needed here because of a known
proptest
issue.
Revert to the derive-macro implementation once the issue1 is fixed.
§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Union<BoxedStrategy<AggregateFunc>>
type Strategy = Union<BoxedStrategy<AggregateFunc>>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
source§impl Clone for AggregateFunc
impl Clone for AggregateFunc
source§fn clone(&self) -> AggregateFunc
fn clone(&self) -> AggregateFunc
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AggregateFunc
impl Debug for AggregateFunc
source§impl<'de> Deserialize<'de> for AggregateFunc
impl<'de> Deserialize<'de> for AggregateFunc
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Hash for AggregateFunc
impl Hash for AggregateFunc
source§impl MzReflect for AggregateFunc
impl MzReflect for AggregateFunc
source§fn add_to_reflected_type_info(rti: &mut ReflectedTypeInfo)
fn add_to_reflected_type_info(rti: &mut ReflectedTypeInfo)
rti
. Read moresource§impl Ord for AggregateFunc
impl Ord for AggregateFunc
source§fn cmp(&self, other: &AggregateFunc) -> Ordering
fn cmp(&self, other: &AggregateFunc) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AggregateFunc
impl PartialEq for AggregateFunc
source§impl PartialOrd for AggregateFunc
impl PartialOrd for AggregateFunc
source§impl RustType<ProtoAggregateFunc> for AggregateFunc
impl RustType<ProtoAggregateFunc> for AggregateFunc
source§fn into_proto(&self) -> ProtoAggregateFunc
fn into_proto(&self) -> ProtoAggregateFunc
Self
into a Proto
value.source§fn from_proto(proto: ProtoAggregateFunc) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoAggregateFunc) -> Result<Self, TryFromProtoError>
source§fn into_proto_owned(self) -> Proto
fn into_proto_owned(self) -> Proto
Self::into_proto
that types can
optionally implement, otherwise, the default implementation
delegates to Self::into_proto
.source§impl Serialize for AggregateFunc
impl Serialize for AggregateFunc
impl Eq for AggregateFunc
impl StructuralPartialEq for AggregateFunc
Auto Trait Implementations§
impl Freeze for AggregateFunc
impl RefUnwindSafe for AggregateFunc
impl Send for AggregateFunc
impl Sync for AggregateFunc
impl Unpin for AggregateFunc
impl UnwindSafe for AggregateFunc
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> PreferredContainer for T
impl<T> PreferredContainer for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.