pub enum ArrayExpr<X: Extension = NoExt> {
Elements {
elements: ThinVec<Expr<X>>,
spelling: ArraySpelling,
meta: Meta,
},
Subquery {
query: Box<Query<X>>,
meta: Meta,
},
Comprehension {
comprehension: Box<ListComprehension<X>>,
meta: Meta,
},
}Expand description
An array/list constructor.
Either an element list (ARRAY[a, b], possibly empty ARRAY[], or the DuckDB
bare-bracket [a, b]) or a subquery (ARRAY(SELECT …)). Boxed inside
Expr::Array to keep the hot expression enum within its size budget.
Variants§
Elements
ARRAY[a, b, …] / [a, b, …] (or empty ARRAY[] / []).
Fields
spelling: ArraySpellingWhether the ARRAY keyword was written (vs. the bare […] form).
Subquery
ARRAY(<query>) — always the keyword form (DuckDB has no bracket-subquery
spelling).
Fields
Comprehension
A DuckDB list comprehension [element for var in source (if filter)?]
(boxed; see ListComprehension). A distinct list-literal production from the
element/subquery forms above: the same […] bracket opens it, but the
for after the first element selects the comprehension rather than an element
list. Gated by
collection_literals —
the same flag that admits the bracket list.
Fields
comprehension: Box<ListComprehension<X>>The list comprehension; see ListComprehension.