pub struct LateralView<X: Extension = NoExt> {
pub outer: bool,
pub function: FunctionCall<X>,
pub alias: Ident,
pub columns: ThinVec<Ident>,
pub meta: Meta,
}Expand description
One Hive/Spark LATERAL VIEW [OUTER] <generator>(args) <alias> [AS <col> [, …]]
clause on a Select (Select::lateral_views): a table-generating function
(explode, posexplode, json_tuple, …) whose output rows are cross-joined
against each input row, with OUTER keeping input rows the generator produces no
rows for (NULL-padded, like an outer join).
§Parity with sqlparser-rs LateralView
Mirrors sqlparser-rs’s LateralView struct (lateral_view: Expr,
lateral_view_name: ObjectName, lateral_col_alias: Vec<Ident>, outer: bool),
with two deliberate reshapings (ADR-0011’s typed canonical shape) and one rename:
lateral_view: Expr→function:FunctionCall— both grammars require a generator call here (HiveFromClauseParser.glateralView: … function tableAlias …; SparkSqlBaseParser.g4lateralView: LATERAL VIEW OUTER? qualifiedName '(' expression* ')' …), so the typed call node is the grammar, where sqlparser-rs’s arbitrary expression over-admits non-calls.lateral_view_name: ObjectName→alias:Ident— the correlation alias is a single identifier in both grammars (HivetableAlias, SparktblName=identifier), never a qualified name.lateral_col_alias→columns, aThinVec<Ident>(empty when unwritten — column aliases are optional since Hive 0.12).
§Acceptance bound (no Hive/Spark oracle)
The table alias is required (both grammars make it non-optional) and the AS
before the column list is optional — Spark’s grammar spells AS? while Hive’s
requires the keyword, so accepting the bare-column spelling under the one atomic
flag is a known conservative-direction over-acceptance for the Hive preset
(the JoinSyntax::sided_semi_anti_join
precedent, captured on the owning ticket). Rendering canonicalizes the bare
spelling to AS — a structural, not byte-exact, round-trip (the wildcard-modifier
precedent). Whether the named function is a genuine UDTF is a bind-time check past
the parse-level contract.
§Gating and LATERAL disambiguation
Gated by SelectSyntax::lateral_view_clause — on
for Hive, Databricks, and the permissive Lenient union, off elsewhere; with the
gate off the LATERAL keyword in this position is left unconsumed and surfaces as
a clean parse error. LATERAL also introduces the standard LATERAL derived-table /
function factor (TableFactorSyntax::lateral),
but the two occupy disjoint grammar positions — a table-factor head (after
FROM/,/a join keyword) versus after the whole FROM list — and additionally
partition on the follow token (VIEW here; ( or a function/subquery head there),
so the dispatch is unambiguous under every preset combination, including Lenient
(which enables both), and needs no
GrammarConflict registry entry.
Fields§
§outer: boolOUTER — keep input rows the generator returns no rows for, NULL-padding the
generated columns (Hive/Spark’s outer-join refinement of the default
cross-join semantics).
function: FunctionCall<X>The table-generating function call (explode(col)); inline, not boxed,
because this node lives only behind Select::lateral_views’ heap allocation
(the RowsFromItem precedent).
alias: IdentThe required correlation alias naming the generated relation (Hive
tableAlias / Spark tblName).
columns: ThinVec<Ident>The [AS] c1, c2 column aliases naming the generator’s output columns; empty
when unwritten.
meta: MetaSource location and node identity.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for LateralView<X>
impl<X: Clone + Extension> Clone for LateralView<X>
Source§fn clone(&self) -> LateralView<X>
fn clone(&self) -> LateralView<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 LateralView<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for LateralView<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 LateralView<X>
Source§impl<X: Extension + Render> Render for LateralView<X>
impl<X: Extension + Render> Render for LateralView<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 LateralView<X>
impl<X> Serialize for LateralView<X>
Source§impl<X: Extension> Spanned for LateralView<X>
impl<X: Extension> Spanned for LateralView<X>
impl<X: PartialEq + Extension> StructuralPartialEq for LateralView<X>
Auto Trait Implementations§
impl<X> Freeze for LateralView<X>
impl<X> RefUnwindSafe for LateralView<X>where
X: RefUnwindSafe,
impl<X> Send for LateralView<X>where
X: Send,
impl<X> Sync for LateralView<X>where
X: Sync,
impl<X> Unpin for LateralView<X>where
X: Unpin,
impl<X> UnsafeUnpin for LateralView<X>
impl<X> UnwindSafe for LateralView<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.