Support `UNNEST` as table function (UDTF)
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Is your feature request related to a problem or challenge?
`UNNEST` is implemented in two ways, `SELECT UNNEST(...)` is handled with other functions https://github.com/apache/datafusion/blob/84232d806070f4b177e35148255c501a5f6e740b/datafusion/sql/src/expr/function.rs#L246-L255
And `SELECT ... FROM UNNEST(...)` is provided as `TableFactory` https://github.com/apache/datafusion/blob/84232d806070f4b177e35148255c501a5f6e740b/datafusion/sql/src/relation/mod.rs#L117-L123
But those two ways are both non-generic, cases like substrait can't handle it properly, as the decoder will try to look for table function:
```rs
async fn roundtrip_unnest() -> Result<()> {
roundtrip("SELECT * FROM unnest([1, 2, 3])").await
}
```
### Describe the solution you'd like
Implement `UNNEST` as a table function, making it more general and reduce the complexity (and branches) of implementation
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.