You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "vincev (via GitHub)" <gi...@apache.org> on 2023/02/07 14:00:50 UTC
[GitHub] [arrow-datafusion] vincev opened a new pull request, #5214: Add support to SQL parser for unnest function.
vincev opened a new pull request, #5214:
URL: https://github.com/apache/arrow-datafusion/pull/5214
# Which issue does this PR close?
This PR introduces initial changes to add support for calling `unnest` function in SQL as requested in #212.
I am going to try to implement the functionality by creating small PRs so that is easier to review, this PR only adds support for parsing the query.
# Rationale for this change
Following #5106 that adds `unnest_column` to `DataFrame` this PR starts to add support for the following SQL:
```sql
SELECT first_name, last_name, UNNEST(aliases) FROM unnested_test
```
that will unnest the aliases column if it is an array column.
# What changes are included in this PR?
- Add `Unnest` to the list of built in functions enums
- Add support for getting `Unnest` function return type
- Add `Unnest` function to the list of scalar functions in protobuf definition
- Add integration test for parsing query with `Unnest` call.
# Are these changes tested?
Add SQL parsing test [here](https://github.com/vincev/arrow-datafusion/blob/27ceec775ace5766d1c926d5f6cd46c18cb54705/datafusion/sql/tests/integration_test.rs#L2403)
# Are there any user-facing changes?
No facing changes as this PR add initial plumbing.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] vincev closed pull request #5214: Add support to SQL parser for unnest function.
Posted by "vincev (via GitHub)" <gi...@apache.org>.
vincev closed pull request #5214: Add support to SQL parser for unnest function.
URL: https://github.com/apache/arrow-datafusion/pull/5214
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] vincev commented on pull request #5214: Add support to SQL parser for unnest function.
Posted by "vincev (via GitHub)" <gi...@apache.org>.
vincev commented on PR #5214:
URL: https://github.com/apache/arrow-datafusion/pull/5214#issuecomment-1428678170
Going to close this PR I have found more problems with where conditions on unnested columns.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] vincev commented on pull request #5214: Add support to SQL parser for unnest function.
Posted by "vincev (via GitHub)" <gi...@apache.org>.
vincev commented on PR #5214:
URL: https://github.com/apache/arrow-datafusion/pull/5214#issuecomment-1428279764
Just found a problem while adding more tests, if I run the following:
```rust
let ctx = SessionContext::new();
ctx.sql("create external table shapes stored as parquet location 'nested.parquet'").await?;
ctx.sql("select count(unnest(tags)) from shapes").await?.show().await;
```
I get the correct output:
```
+--------------------+
| COUNT(shapes.tags) |
+--------------------+
| 8 |
+--------------------+
```
but if I run the same query with `register_parquet`:
```rust
let ctx = SessionContext::new();
let df = ctx.register_parquet("shapes", "nested.parquet", ParquetReadOptions::default()).await?;
ctx.sql("select count(unnest(tags)) from shapes").await?.show().await;
```
the `UnnestExec` gets optimized away somehow (its execute is not called) and I get this:
```
+--------------------+
| COUNT(shapes.tags) |
+--------------------+
| 4 |
+--------------------+
```
I'll investigate.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org