Skip to main content

FunctionCall

Struct FunctionCall 

Source
pub struct FunctionCall<X: Extension = NoExt> {
Show 13 fields pub name: ObjectName, pub quantifier: Option<SetQuantifier>, pub args: ThinVec<FunctionArg<X>>, pub wildcard: bool, pub order_by: ThinVec<OrderByExpr<X>>, pub within_group: Option<ThinVec<OrderByExpr<X>>>, pub separator: Option<Literal>, pub filter: Option<Box<Expr<X>>>, pub filter_where: FilterWhereSpelling, pub over: Option<WindowSpec<X>>, pub null_treatment: Option<NullTreatment>, pub window_tail: Option<WindowFunctionTail>, pub meta: Meta,
}
Expand description

A function or aggregate call: name([DISTINCT] args | *) plus the optional aggregate modifiers an ordered-set / filtered aggregate carries.

Boxed inside Expr::Function so the hot expression enum stays within its size budget. The same canonical shape covers plain scalar calls (COALESCE, NULLIF, GREATEST, LEAST, …) and aggregates; unused modifier fields stay at their empty defaults (one shape per construct).

Fields§

§name: ObjectName

Name referenced by this syntax.

§quantifier: Option<SetQuantifier>

The ALL / DISTINCT argument quantifier, as in count(DISTINCT x) or count(ALL x); None for a call written with no quantifier. DISTINCT ON is a SELECT-list-only form, so an aggregate never carries it.

§args: ThinVec<FunctionArg<X>>

The argument list, each a positional or PostgreSQL named argument (see FunctionArg). Empty for a no-arg call or a * call.

§wildcard: bool

* as the sole argument, as in count(*). Mutually exclusive with args.

§order_by: ThinVec<OrderByExpr<X>>

ORDER BY inside an ordered-set aggregate, as in array_agg(x ORDER BY y).

§within_group: Option<ThinVec<OrderByExpr<X>>>

WITHIN GROUP (ORDER BY <keys>) — the SQL:2008 ordered-set aggregate clause (T612/T614), as in percentile_cont(0.5) WITHIN GROUP (ORDER BY x). A post-argument clause parsed after the ), mirroring the optionality of filter and over; None when absent, and the list is non-empty when present (the grammar requires a sort key). Distinct from the in-parenthesis order_by: PostgreSQL admits at most one of the two, and they render in different positions.

§separator: Option<Literal>

SEPARATOR <string> — the MySQL GROUP_CONCAT(... SEPARATOR ',') delimiter, an in-parenthesis argument tail parsed after order_by and before the closing ). Gated for acceptance by AggregateCallSyntax::group_concat_separator: None when the dialect leaves the flag off or the clause is unwritten. The delimiter is always a string constant, so it is a bare Literal rather than a general expression — one canonical field on the shared call shape, not a GROUP_CONCAT-specific node.

§filter: Option<Box<Expr<X>>>

FILTER (WHERE <predicate>) applied to an aggregate.

§filter_where: FilterWhereSpelling

Whether the filter clause wrote the standard WHERE keyword (FILTER (WHERE p)) or DuckDB’s keyword-less FILTER (p). A pure fidelity tag — the FilterWhereSpelling round-trips the surface spelling. Carries the canonical Where when no filter is present.

§over: Option<WindowSpec<X>>

The OVER (…) / OVER name window clause that makes this a window function call; None for a plain scalar or aggregate call.

§null_treatment: Option<NullTreatment>

IGNORE NULLS / RESPECT NULLS null-treatment written inside the call parentheses, after the argument list (and any in-parenthesis ORDER BY), as in DuckDB’s last(s IGNORE NULLS) OVER (…). None when unwritten. One canonical field on the shared call shape, the NullTreatment tag recording which the source used so it round-trips. Gated for acceptance by AggregateCallSyntax::null_treatment: DuckDB spells the SQL:2016 null-treatment inside the parentheses (the standard’s post-) position engine-rejects on 1.5.4), so it rides the in-parenthesis tail like separator rather than a post-argument clause. When the dialect leaves the flag off, IGNORE/RESPECT is left unconsumed and the unmatched ) surfaces as a clean parse error.

§window_tail: Option<WindowFunctionTail>

The MySQL window-function post-) tail — the SQL:2016 [FROM {FIRST | LAST}] [{RESPECT | IGNORE} NULLS] clauses a null-treatment window function carries between its argument ) and its OVER clause, as in NTH_VALUE(x, 2) FROM FIRST RESPECT NULLS OVER (…). None when no tail was written. A separate field from the in-parenthesis DuckDB null_treatment precisely because the surface position differs: MySQL spells these after the ) and rejects the in-paren spelling (ER_PARSE_ERROR, 1064), while DuckDB rejects the post-) one — so the two positions round-trip as distinct fields on the shared call shape rather than a shared field plus a position tag the DuckDB path would also carry. Gated for acceptance by AggregateCallSyntax::window_function_tail: MySQL admits it only on the null-treatment window functions (LEAD/LAG/FIRST_VALUE/LAST_VALUE/NTH_VALUE, with FROM FIRST on NTH_VALUE alone), enforced by the parser’s window-grammar gate.

§meta: Meta

Source location and node identity.

Trait Implementations§

Source§

impl<X: Clone + Extension> Clone for FunctionCall<X>

Source§

fn clone(&self) -> FunctionCall<X>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<X: Debug + Extension> Debug for FunctionCall<X>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, X> Deserialize<'de> for FunctionCall<X>
where X: Deserialize<'de> + Extension,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<X: Eq + Extension> Eq for FunctionCall<X>

Source§

impl<X: Hash + Extension> Hash for FunctionCall<X>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<X: PartialEq + Extension> PartialEq for FunctionCall<X>

Source§

fn eq(&self, other: &FunctionCall<X>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<X: Extension + Render> Render for FunctionCall<X>

Source§

fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result

Return the render for this value.
Source§

fn operand_binding_power(&self) -> Option<BindingPower>

The binding power this node contributes when it appears as an operand, or None (the default) for a self-delimiting node — an atom, call, or constructor — that never needs parentheses. Read more
Source§

impl<X> Serialize for FunctionCall<X>
where X: Serialize + Extension,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<X: Extension> Spanned for FunctionCall<X>

Source§

fn span(&self) -> Span

Return the span for this value.
Source§

impl<X: PartialEq + Extension> StructuralPartialEq for FunctionCall<X>

Auto Trait Implementations§

§

impl<X> Freeze for FunctionCall<X>

§

impl<X> RefUnwindSafe for FunctionCall<X>
where X: RefUnwindSafe,

§

impl<X> Send for FunctionCall<X>
where X: Send,

§

impl<X> Sync for FunctionCall<X>
where X: Sync,

§

impl<X> Unpin for FunctionCall<X>
where X: Unpin,

§

impl<X> UnsafeUnpin for FunctionCall<X>

§

impl<X> UnwindSafe for FunctionCall<X>
where X: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynAstExt for T
where T: Extension + Render + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Erase to &dyn Any for downcasting a node back to its concrete type.
Source§

fn dyn_clone(&self) -> Box<dyn DynAstExt>

Clone into a fresh box — the object-safe stand-in for Clone (whose Self-returning signature cannot go through a vtable).
Source§

fn dyn_eq(&self, other: &dyn DynAstExt) -> bool

Structural equality against another erased node — the object-safe stand-in for PartialEq (whose &Self argument cannot go through a vtable). Equal iff other holds the same concrete type and that type deems the values equal; differently-typed nodes are never equal.
Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feed this node’s hash into an erased hasher — the object-safe stand-in for Hash::hash (whose generic H: Hasher cannot go through a vtable).
Source§

impl<T> Extension for T
where T: Clone + Debug + Eq + Hash + Spanned,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> RenderExt for T
where T: Render,

Source§

fn displayed<'a>(&'a self, ctx: &'a RenderCtx<'a>) -> Displayed<'a, T>

Pair this node with an explicit canonical RenderCtx so format!, to_string, and {} render it. This is the canonical path: the ctx’s resolver and source must match the node’s parse.
Source§

fn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>
where Self: Sized,

Render this node for debugging against an explicitly-supplied resolver (the debug-SQL mitigation), returning a Display adapter. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.