MCPcopy Create free account
hub / github.com/apache/datafusion / is_at_struct_allowed_root

Method is_at_struct_allowed_root

datafusion/sql/src/utils.rs:418–427  ·  view source on GitHub ↗

Check if the current expression is at the root level for struct unnest purposes. This is true if: 1. The expression IS the root expression, OR 2. The root expression is an Alias wrapping this expression This allows `unnest(struct_col) AS alias` to work, where the alias is simply ignored for struct unnest (matching DuckDB behavior).

(&self, expr: &Expr)

Source from the content-addressed store, hash-verified

416 /// This allows `unnest(struct_col) AS alias` to work, where the alias is simply
417 /// ignored for struct unnest (matching DuckDB behavior).
418 fn is_at_struct_allowed_root(&self, expr: &Expr) -> bool {
419 if expr == self.root_expr {
420 return true;
421 }
422 // Allow struct unnest when root is an alias wrapping the unnest
423 if let Expr::Alias(Alias { expr: inner, .. }) = self.root_expr {
424 return inner.as_ref() == expr;
425 }
426 false
427 }
428
429 fn transform(
430 &mut self,

Callers 1

f_upMethod · 0.80

Calls 1

as_refMethod · 0.45

Tested by

no test coverage detected