Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yukkit opened this issue Apr 4, 2023 · 2 comments · Fixed by #9743
Closed

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

yukkit opened this issue Apr 4, 2023 · 2 comments · Fixed by #9743
Labels
enhancement New feature or request

Comments

@yukkit
Copy link
Contributor

yukkit commented Apr 4, 2023

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

@yukkit yukkit added the enhancement New feature or request label Apr 4, 2023
@crepererum
Copy link
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.

@alamb
Copy link
Contributor

alamb commented Mar 27, 2024

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants