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

Method get_struct_unnest_columns

datafusion/sql/src/select.rs:538–565  ·  view source on GitHub ↗
(
        &self,
        input: &LogicalPlan,
        expr: &Expr,
    )

Source from the content-addressed store, hash-verified

536 }
537
538 fn get_struct_unnest_columns(
539 &self,
540 input: &LogicalPlan,
541 expr: &Expr,
542 ) -> Result<Option<Vec<Column>>> {
543 let unnest_expr = match expr {
544 Expr::Unnest(unnest_expr) => Some(unnest_expr),
545 Expr::Alias(alias) => match alias.expr.as_ref() {
546 Expr::Unnest(unnest_expr) => Some(unnest_expr),
547 _ => None,
548 },
549 _ => None,
550 };
551
552 let Some(unnest_expr) = unnest_expr else {
553 return Ok(None);
554 };
555
556 let field = unnest_expr.expr.to_field(input.schema())?.1;
557 let DataType::Struct(inner_fields) = field.data_type() else {
558 return Ok(None);
559 };
560
561 Ok(Some(get_struct_unnested_columns(
562 &unnest_expr.expr.schema_name().to_string(),
563 inner_fields,
564 )))
565 }
566
567 fn try_process_aggregate_unnest(&self, input: LogicalPlan) -> Result<LogicalPlan> {
568 match input {

Callers 1

try_process_unnestMethod · 0.80

Calls 7

to_fieldMethod · 0.80
as_refMethod · 0.45
schemaMethod · 0.45
data_typeMethod · 0.45
to_stringMethod · 0.45
schema_nameMethod · 0.45

Tested by

no test coverage detected