Skip to content

Unnest function is the subexpression in the projection #9591

@YjyJeff

Description

@YjyJeff

Is your feature request related to a problem or challenge?

When we use unnest, we may use it as a subexpression, for example:

select unnest(array_remove(col, 1)) as a from unnest_table;

Currently, datafusion does not support it and will report a bug.

Describe the solution you'd like

Translate the unnest function to the following pattern:

Projection expr_to_execute_the_parent_expr_of_unnest
   Unnest unnest_column
        Projection expr_to_execute_the_child_expr_of_unnest

For example, above SQL will be translated to:

Projection Alias(unnest(array_remove(col, 1)), a) 
    Unnest unnest(array_remove(col,1))
        Projection array_remove(col, 1) as unnest(array_remove(col, 1))

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions