Re-work API for list.to_struct()
#19525
Labels
A-api
Area: changes to the public API
A-dtype-list/array
Area: list/array data type
enhancement
New feature or an improvement of an existing feature
P-low
Priority: low
Milestone
Description
This is what the current API looks like:
This is problematic for Lazy execution, as if a user calls
list.to_struct()
without specifying the field names, it can lead to confusing errors in subsequent expressions as we cannot determine the schema during IR resolution - e.g.list.to_struct().struct.unnest()
fails #19812struct.prefix_fields()
fails afterlist.to_struct()
with InvalidOperationError #20137.list.to_struct
#16370.list.to_struct()
has non-deterministic behavior #16450Specifically, the error message could look something like
struct.prefix_fields() not supported for dtype Unknown
. It's not immediately clear that this is due to having done alist.to_struct()
without specifying field names earlier in the query.I would propose something like:
Where we would forbid arguments that have an ambiguous number of output columns when executing on a
LazyFrame
:error: infer_fields must be specified
Notes
arr.to_struct
The text was updated successfully, but these errors were encountered: