Struct substrait::proto::expression::WindowFunction
source · pub struct WindowFunction {
pub function_reference: u32,
pub arguments: Vec<FunctionArgument>,
pub options: Vec<FunctionOption>,
pub output_type: Option<Type>,
pub phase: i32,
pub sorts: Vec<SortField>,
pub invocation: i32,
pub partitions: Vec<Expression>,
pub bounds_type: i32,
pub lower_bound: Option<Bound>,
pub upper_bound: Option<Bound>,
pub args: Vec<Expression>,
}
Expand description
A window function call.
Fields§
§function_reference: u32
Points to a function_anchor defined in this plan. The function must be:
- a window function
- an aggregate function
An aggregate function referenced here should be treated as a window function with Window Type STREAMING
Required; 0 is considered to be a valid anchor/reference.
arguments: Vec<FunctionArgument>
The arguments to be bound to the function. This must have exactly the number of arguments specified in the function definition, and the argument types must also match exactly:
- Value arguments must be bound using FunctionArgument.value, and the expression in that must yield a value of a type that a function overload is defined for.
- Type arguments must be bound using FunctionArgument.type, and a function overload must be defined for that type.
- Enum arguments must be bound using FunctionArgument.enum followed by Enum.specified, with a string that case-insensitively matches one of the allowed options.
options: Vec<FunctionOption>
Options to specify behavior for corner cases, or leave behavior unspecified if the consumer does not need specific behavior in these cases.
output_type: Option<Type>
Must be set to the return type of the function, exactly as derived using the declaration in the extension.
phase: i32
Describes which part of the window function to perform within the context of distributed algorithms. Required. Must be set to INITIAL_TO_RESULT for window functions that are not decomposable.
sorts: Vec<SortField>
If specified, the records that are part of the window defined by upper_bound and lower_bound are ordered according to this list before they are aggregated. The first sort field has the highest priority; only if a sort field determines two records to be equivalent is the next field queried. This field is optional, and is only allowed if the window function is defined to support sorting.
invocation: i32
Specifies whether equivalent records are merged before being aggregated. Optional, defaults to AGGREGATION_INVOCATION_ALL.
partitions: Vec<Expression>
When one or more partition expressions are specified, two records are considered to be in the same partition if and only if these expressions yield an equal record of values for both. When computing the window function, only the subset of records within the bounds that are also in the same partition as the current record are aggregated.
bounds_type: i32
Defines the bounds type: ROWS, RANGE
lower_bound: Option<Bound>
Defines the record relative to the current record from which the window extends. The bound is inclusive. If the lower bound indexes a record greater than the upper bound, TODO (null range/no records passed? wrapping around as if lower/upper were swapped? error? null?). Optional; defaults to the start of the partition.
upper_bound: Option<Bound>
Defines the record relative to the current record up to which the window extends. The bound is inclusive. If the upper bound indexes a record less than the lower bound, TODO (null range/no records passed? wrapping around as if lower/upper were swapped? error? null?). Optional; defaults to the end of the partition.
args: Vec<Expression>
Deprecated; use arguments instead.
Implementations§
source§impl WindowFunction
impl WindowFunction
sourcepub fn phase(&self) -> AggregationPhase
pub fn phase(&self) -> AggregationPhase
Returns the enum value of phase
, or the default if the field is set to an invalid enum value.
sourcepub fn set_phase(&mut self, value: AggregationPhase)
pub fn set_phase(&mut self, value: AggregationPhase)
Sets phase
to the provided enum value.
sourcepub fn invocation(&self) -> AggregationInvocation
pub fn invocation(&self) -> AggregationInvocation
Returns the enum value of invocation
, or the default if the field is set to an invalid enum value.
sourcepub fn set_invocation(&mut self, value: AggregationInvocation)
pub fn set_invocation(&mut self, value: AggregationInvocation)
Sets invocation
to the provided enum value.
sourcepub fn bounds_type(&self) -> BoundsType
pub fn bounds_type(&self) -> BoundsType
Returns the enum value of bounds_type
, or the default if the field is set to an invalid enum value.
sourcepub fn set_bounds_type(&mut self, value: BoundsType)
pub fn set_bounds_type(&mut self, value: BoundsType)
Sets bounds_type
to the provided enum value.
Trait Implementations§
source§impl Clone for WindowFunction
impl Clone for WindowFunction
source§fn clone(&self) -> WindowFunction
fn clone(&self) -> WindowFunction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WindowFunction
impl Debug for WindowFunction
source§impl Default for WindowFunction
impl Default for WindowFunction
§impl<'de> Deserialize<'de> for WindowFunction
impl<'de> Deserialize<'de> for WindowFunction
§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 Message for WindowFunction
impl Message for WindowFunction
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.source§impl PartialEq for WindowFunction
impl PartialEq for WindowFunction
source§fn eq(&self, other: &WindowFunction) -> bool
fn eq(&self, other: &WindowFunction) -> bool
self
and other
values to be equal, and is used
by ==
.§impl Serialize for WindowFunction
impl Serialize for WindowFunction
impl StructuralPartialEq for WindowFunction
Auto Trait Implementations§
impl Freeze for WindowFunction
impl RefUnwindSafe for WindowFunction
impl Send for WindowFunction
impl Sync for WindowFunction
impl Unpin for WindowFunction
impl UnwindSafe for WindowFunction
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
)