pub struct SimpleAggregateUDF { /* private fields */ }
Expand description
Implements AggregateUDFImpl
for functions that have a single signature and
return type.
Implementations§
Source§impl SimpleAggregateUDF
impl SimpleAggregateUDF
Sourcepub fn new(
name: impl Into<String>,
input_type: Vec<DataType>,
return_type: DataType,
volatility: Volatility,
accumulator: Arc<dyn Fn(AccumulatorArgs<'_>) -> Result<Box<dyn Accumulator>, DataFusionError> + Send + Sync>,
state_fields: Vec<Field>,
) -> SimpleAggregateUDF
pub fn new( name: impl Into<String>, input_type: Vec<DataType>, return_type: DataType, volatility: Volatility, accumulator: Arc<dyn Fn(AccumulatorArgs<'_>) -> Result<Box<dyn Accumulator>, DataFusionError> + Send + Sync>, state_fields: Vec<Field>, ) -> SimpleAggregateUDF
Create a new SimpleAggregateUDF
from a name, input types, return type, state type and
implementation. Implementing AggregateUDFImpl
allows more flexibility
Sourcepub fn new_with_signature(
name: impl Into<String>,
signature: Signature,
return_type: DataType,
accumulator: Arc<dyn Fn(AccumulatorArgs<'_>) -> Result<Box<dyn Accumulator>, DataFusionError> + Send + Sync>,
state_fields: Vec<Field>,
) -> SimpleAggregateUDF
pub fn new_with_signature( name: impl Into<String>, signature: Signature, return_type: DataType, accumulator: Arc<dyn Fn(AccumulatorArgs<'_>) -> Result<Box<dyn Accumulator>, DataFusionError> + Send + Sync>, state_fields: Vec<Field>, ) -> SimpleAggregateUDF
Create a new SimpleAggregateUDF
from a name, signature, return type, state type and
implementation. Implementing AggregateUDFImpl
allows more flexibility
Trait Implementations§
Source§impl AggregateUDFImpl for SimpleAggregateUDF
impl AggregateUDFImpl for SimpleAggregateUDF
Source§fn signature(&self) -> &Signature
fn signature(&self) -> &Signature
Returns the function’s
Signature
for information about what input
types are accepted and the function’s Volatility.Source§fn return_type(
&self,
_arg_types: &[DataType],
) -> Result<DataType, DataFusionError>
fn return_type( &self, _arg_types: &[DataType], ) -> Result<DataType, DataFusionError>
What
DataType
will be returned by this function, given the types of
the argumentsSource§fn accumulator(
&self,
acc_args: AccumulatorArgs<'_>,
) -> Result<Box<dyn Accumulator>, DataFusionError>
fn accumulator( &self, acc_args: AccumulatorArgs<'_>, ) -> Result<Box<dyn Accumulator>, DataFusionError>
Return a new
Accumulator
that aggregates values for a specific
group during query execution. Read moreSource§fn state_fields(
&self,
_args: StateFieldsArgs<'_>,
) -> Result<Vec<Field>, DataFusionError>
fn state_fields( &self, _args: StateFieldsArgs<'_>, ) -> Result<Vec<Field>, DataFusionError>
Return the fields used to store the intermediate state of this accumulator. Read more
Source§fn schema_name(
&self,
params: &AggregateFunctionParams,
) -> Result<String, DataFusionError>
fn schema_name( &self, params: &AggregateFunctionParams, ) -> Result<String, DataFusionError>
Returns the name of the column this expression would create Read more
Source§fn human_display(
&self,
params: &AggregateFunctionParams,
) -> Result<String, DataFusionError>
fn human_display( &self, params: &AggregateFunctionParams, ) -> Result<String, DataFusionError>
Returns a human readable expression. Read more
Source§fn window_function_schema_name(
&self,
params: &WindowFunctionParams,
) -> Result<String, DataFusionError>
fn window_function_schema_name( &self, params: &WindowFunctionParams, ) -> Result<String, DataFusionError>
Returns the name of the column this expression would create Read more
Source§fn display_name(
&self,
params: &AggregateFunctionParams,
) -> Result<String, DataFusionError>
fn display_name( &self, params: &AggregateFunctionParams, ) -> Result<String, DataFusionError>
Returns the user-defined display name of function, given the arguments Read more
Source§fn window_function_display_name(
&self,
params: &WindowFunctionParams,
) -> Result<String, DataFusionError>
fn window_function_display_name( &self, params: &WindowFunctionParams, ) -> Result<String, DataFusionError>
Returns the user-defined display name of function, given the arguments Read more
Source§fn is_nullable(&self) -> bool
fn is_nullable(&self) -> bool
Whether the aggregate function is nullable. Read more
Source§fn groups_accumulator_supported(&self, _args: AccumulatorArgs<'_>) -> bool
fn groups_accumulator_supported(&self, _args: AccumulatorArgs<'_>) -> bool
If the aggregate expression has a specialized
GroupsAccumulator
implementation. If this returns true,
[Self::create_groups_accumulator]
will be called. Read moreSource§fn create_groups_accumulator(
&self,
_args: AccumulatorArgs<'_>,
) -> Result<Box<dyn GroupsAccumulator>, DataFusionError>
fn create_groups_accumulator( &self, _args: AccumulatorArgs<'_>, ) -> Result<Box<dyn GroupsAccumulator>, DataFusionError>
Return a specialized
GroupsAccumulator
that manages state
for all groups. Read moreSource§fn aliases(&self) -> &[String]
fn aliases(&self) -> &[String]
Returns any aliases (alternate names) for this function. Read more
Source§fn create_sliding_accumulator(
&self,
args: AccumulatorArgs<'_>,
) -> Result<Box<dyn Accumulator>, DataFusionError>
fn create_sliding_accumulator( &self, args: AccumulatorArgs<'_>, ) -> Result<Box<dyn Accumulator>, DataFusionError>
Sliding accumulator is an alternative accumulator that can be used for
window functions. It has retract method to revert the previous update. Read more
Source§fn with_beneficial_ordering(
self: Arc<Self>,
_beneficial_ordering: bool,
) -> Result<Option<Arc<dyn AggregateUDFImpl>>, DataFusionError>
fn with_beneficial_ordering( self: Arc<Self>, _beneficial_ordering: bool, ) -> Result<Option<Arc<dyn AggregateUDFImpl>>, DataFusionError>
Sets the indicator whether ordering requirements of the AggregateUDFImpl is
satisfied by its input. If this is not the case, UDFs with order
sensitivity
AggregateOrderSensitivity::Beneficial
can still produce
the correct result with possibly more work internally. Read moreSource§fn order_sensitivity(&self) -> AggregateOrderSensitivity
fn order_sensitivity(&self) -> AggregateOrderSensitivity
Gets the order sensitivity of the UDF. See
AggregateOrderSensitivity
for possible options.Source§fn simplify(
&self,
) -> Option<Box<dyn Fn(AggregateFunction, &dyn SimplifyInfo) -> Result<Expr, DataFusionError>>>
fn simplify( &self, ) -> Option<Box<dyn Fn(AggregateFunction, &dyn SimplifyInfo) -> Result<Expr, DataFusionError>>>
Optionally apply per-UDaF simplification / rewrite rules. Read more
Source§fn reverse_expr(&self) -> ReversedUDAF
fn reverse_expr(&self) -> ReversedUDAF
Returns the reverse expression of the aggregate function.
Source§fn coerce_types(
&self,
_arg_types: &[DataType],
) -> Result<Vec<DataType>, DataFusionError>
fn coerce_types( &self, _arg_types: &[DataType], ) -> Result<Vec<DataType>, DataFusionError>
Coerce arguments of a function call to types that the function can evaluate. Read more
Source§fn equals(&self, other: &dyn AggregateUDFImpl) -> bool
fn equals(&self, other: &dyn AggregateUDFImpl) -> bool
Return true if this aggregate UDF is equal to the other. Read more
Source§fn hash_value(&self) -> u64
fn hash_value(&self) -> u64
Returns a hash value for this aggregate UDF. Read more
Source§fn is_descending(&self) -> Option<bool>
fn is_descending(&self) -> Option<bool>
If this function is max, return true
If the function is min, return false
Otherwise return None (the default) Read more
Source§fn value_from_stats(
&self,
_statistics_args: &StatisticsArgs<'_>,
) -> Option<ScalarValue>
fn value_from_stats( &self, _statistics_args: &StatisticsArgs<'_>, ) -> Option<ScalarValue>
Return the value of this aggregate function if it can be determined
entirely from statistics and arguments. Read more
Source§fn default_value(
&self,
data_type: &DataType,
) -> Result<ScalarValue, DataFusionError>
fn default_value( &self, data_type: &DataType, ) -> Result<ScalarValue, DataFusionError>
Returns default value of the function given the input is all
null
. Read moreSource§fn documentation(&self) -> Option<&Documentation>
fn documentation(&self) -> Option<&Documentation>
Returns the documentation for this Aggregate UDF. Read more
Source§fn set_monotonicity(&self, _data_type: &DataType) -> SetMonotonicity
fn set_monotonicity(&self, _data_type: &DataType) -> SetMonotonicity
Indicates whether the aggregation function is monotonic as a set
function. See
SetMonotonicity
for details.Auto Trait Implementations§
impl Freeze for SimpleAggregateUDF
impl !RefUnwindSafe for SimpleAggregateUDF
impl Send for SimpleAggregateUDF
impl Sync for SimpleAggregateUDF
impl Unpin for SimpleAggregateUDF
impl !UnwindSafe for SimpleAggregateUDF
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
The
AlignTo*
type which aligns Self
to ALIGNMENT
.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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
Gets a reference to a field, determined by
offset
. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
Gets a muatble reference to a field, determined by
offset
. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
Gets a const pointer to a field,
the field is determined by
offset
. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
Gets a mutable pointer to a field, determined by
offset
. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
Replaces a field (determined by
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
Replaces a field (determined by
offset
) with value
,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Emulates the pipeline operator, allowing method syntax in more places. Read more
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
The same as
piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
The same as
piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Mutates self using a closure taking self by mutable reference,
passing it along the method chain. Read more
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Observes the value of self, passing it along unmodified.
Useful in long method chains. Read more
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
Performs a reference to reference conversion with
AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read moreSource§impl<This> TransmuteElement for Thiswhere
This: ?Sized,
impl<This> TransmuteElement for Thiswhere
This: ?Sized,
Source§unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
unsafe fn transmute_element<T>(self) -> Self::TransmutedPtrwhere
Self: CanTransmuteElement<T>,
Transmutes the element type of this pointer.. Read more
Source§impl<T> TypeIdentity for Twhere
T: ?Sized,
impl<T> TypeIdentity for Twhere
T: ?Sized,
Source§fn as_type_mut(&mut self) -> &mut Self::Type
fn as_type_mut(&mut self) -> &mut Self::Type
Converts a mutable reference back to the original type.
Source§fn into_type_box(self: Box<Self>) -> Box<Self::Type>
fn into_type_box(self: Box<Self>) -> Box<Self::Type>
Converts a box back to the original type.
Source§fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>
Converts an Arc back to the original type. Read more
Source§fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>
Converts an Rc back to the original type. Read more
Source§fn from_type_ref(this: &Self::Type) -> &Self
fn from_type_ref(this: &Self::Type) -> &Self
Converts a reference back to the original type.
Source§fn from_type_mut(this: &mut Self::Type) -> &mut Self
fn from_type_mut(this: &mut Self::Type) -> &mut Self
Converts a mutable reference back to the original type.
Source§fn from_type_box(this: Box<Self::Type>) -> Box<Self>
fn from_type_box(this: Box<Self::Type>) -> Box<Self>
Converts a box back to the original type.