gstvg opened a new pull request, #9743: URL: https://github.com/apache/arrow-datafusion/pull/9743
## Which issue does this PR close? Closes #5861 ## What changes are included in this PR? 1. Add a new scalar function `named_struct` which accepts pairs of name and values, made possible with #8985 2. Transform [sqlparser::Expr::Struct](https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Expr.html#variant.Struct) into a `named_struct` call, instead of the existing `struct`, and if any expression is a [sqlparser::Expr::Named,](https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Expr.html#variant.Named) use its name as the struct field name, otherwise fallback to the currently used cN convention. ## Are these changes tested? Yes, the new scalar function has a unit test similar to the existing struct function, and a sql logic test has been added too. ## Are there any user-facing changes? New scalar function. Existing `struct` function is not changed. ## Alternatives considered 1. Separate new Expr::Struct expression 2. Return the existing `struct` call wrapped in a Expr::Cast to a struct with custom field names, but this would only benefit SQL users. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
