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: ObjectNameName 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: FilterWhereSpellingWhether 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: MetaSource location and node identity.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for FunctionCall<X>
impl<X: Clone + Extension> Clone for FunctionCall<X>
Source§fn clone(&self) -> FunctionCall<X>
fn clone(&self) -> FunctionCall<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for FunctionCall<X>where
X: Deserialize<'de> + Extension,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for FunctionCall<X>
Source§impl<X: Extension + Render> Render for FunctionCall<X>
impl<X: Extension + Render> Render for FunctionCall<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for FunctionCall<X>
impl<X> Serialize for FunctionCall<X>
Source§impl<X: Extension> Spanned for FunctionCall<X>
impl<X: Extension> Spanned for FunctionCall<X>
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> 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
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.