Skip to content

Create a struct with the specified field names and values #5861

Closed

Description

@yukkit

Is your feature request related to a problem or challenge?

I want to construct struct from literal or expression by using sql or rust interface.

like:

Describe the solution you'd like

Add a NamedStruct expression similar to what spark does

sql usage:

SELECT named_struct('a', 1, 'b', 2, 'c', 3);

Describe alternatives you've considered

No response

Additional context

If this issue is useful, I will implement it

Activity

  1. crepererum commented on Apr 20, 2023

    @crepererum
    Contributor

    Note that there is currently NO way to construct a struct with custom field names, because DF also doesn't support casting structs that were constructed using struct(1, 2, 3). But even if such a workaround would be possible, I think having a direct constructor would still be nice.

  2. alamb commented on Mar 27, 2024

    @alamb
    Contributor

    There is a PR up to support named_struct #9743 and work afoot to support nicer literal syntax: #9820 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions