edubraqd opened a new pull request, #24912:
URL: https://github.com/apache/datafusion/pull/24912

   ## Which issue does this PR close?
   
   - Closes #24911.
   
   ## Rationale for this change
   
   `unnest` on a struct is only supported as the top-level select expression. 
Using it anywhere else (`unnest(unnest(struct([1])))`, 
`unnest(struct(1))['c0']`) tripped `assert_or_internal_err!(struct_allowed, 
...)` and produced an internal error asking the user to file a bug. 
`struct_allowed` is derived from the shape of the user's expression, so this is 
a planning error, not a broken invariant.
   
   ## What changes are included in this PR?
   
   Return `plan_err!` with the same message instead of the internal-error 
assertion. The now-unused `assert_or_internal_err` import is dropped.
   
   ## Are these changes tested?
   
   Yes. The existing `unnest.slt` case that had captured the internal-error 
text now expects the planning error, and two more cases 
(`unnest(struct(1))['c0']`, `unnest(unnest(struct([1])))`) are added.
   
   ## Are there any user-facing changes?
   
   The error for a nested `unnest` of a struct is now `Error during planning: 
unnest on struct can only be applied at the root level of select expression`, 
without the "likely caused by a bug in DataFusion" boilerplate.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to