pub struct PythonWorkerAggregateUdf { /* private fields */ }Expand description
An aggregate UDF whose implementation is a cloudpickled Python callable.
Semantics follow PySpark’s GROUPED_AGG pandas UDF: the accumulated rows of
a group are buffered (as Arrow IPC frames appended into AggState) and the
callable is applied to the whole group exactly once at finalize. This makes
the aggregate trivially mergeable across partitions and executors — merge
is byte concatenation of two partial buffers — so it works in distributed
two-phase aggregation (partial per map task, final after the shuffle) through
the existing crate::udf KrishivAggregateAccumulator bridge.
The callable receives each input column of the group as a numpy array (one
positional argument per input column) and returns a Python scalar; a callable
marked _krishiv_arrow_udf=True instead receives the whole Arrow batch.
Implementations§
Trait Implementations§
Source§impl AggregateUdf for PythonWorkerAggregateUdf
impl AggregateUdf for PythonWorkerAggregateUdf
Source§fn name(&self) -> &str
fn name(&self) -> &str
UdfRegistry.Source§fn input_schema(&self) -> &Schema
fn input_schema(&self) -> &Schema
Source§fn output_field(&self) -> &Field
fn output_field(&self) -> &Field
Source§fn accumulate(
&self,
state: &mut AggState,
batch: &RecordBatch,
) -> Result<(), UdfError>
fn accumulate( &self, state: &mut AggState, batch: &RecordBatch, ) -> Result<(), UdfError>
batch into state.Source§fn merge(&self, a: AggState, b: AggState) -> Result<AggState, UdfError>
fn merge(&self, a: AggState, b: AggState) -> Result<AggState, UdfError>
Source§fn finalize(&self, state: AggState) -> Result<ScalarValue, UdfError>
fn finalize(&self, state: AggState) -> Result<ScalarValue, UdfError>
state.Source§fn volatility(&self) -> Volatility
fn volatility(&self) -> Volatility
Auto Trait Implementations§
impl Freeze for PythonWorkerAggregateUdf
impl RefUnwindSafe for PythonWorkerAggregateUdf
impl Send for PythonWorkerAggregateUdf
impl Sync for PythonWorkerAggregateUdf
impl Unpin for PythonWorkerAggregateUdf
impl UnsafeUnpin for PythonWorkerAggregateUdf
impl UnwindSafe for PythonWorkerAggregateUdf
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> ⓘ
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> ⓘ
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<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