Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(query): support more advanced unnest operations. #10329

Merged
merged 4 commits into from
Mar 4, 2023

Conversation

RinChanNOWWW
Copy link
Contributor

@RinChanNOWWW RinChanNOWWW commented Mar 3, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • 1. Be able to wrap unnest in other expressions.
  • 2. unnest will unnest to the end.

Examples:

For 1.

explain select unnest([1,2]) + 1;
+--------------------------------------------------------------+
| explain                                                      |
+--------------------------------------------------------------+
| EvalScalar                                                   |
| ├── expressions: [plus(_unnest, 1)]                          |
| ├── estimated rows: 0.00                                     |
| └── Unnest                                                   |
|     └── EvalScalar                                           |
|         ├── expressions: [[1, 2]]                            |
|         ├── estimated rows: 0.00                             |
|         └── TableScan                                        |
|             ├── table: default.system.one                    |
|             ├── read rows: 1                                 |
|             ├── read bytes: 1                                |
|             ├── partitions total: 1                          |
|             ├── partitions scanned: 1                        |
|             ├── push downs: [filters: [], limit: NONE]       |
|             └── estimated rows: 0.00                         |
+--------------------------------------------------------------+

select unnest([1,2]) + 1;
+--------------------+
| unnest([1, 2]) + 1 |
+--------------------+
|                  2 |
|                  3 |
+--------------------+

For 2.

select unnest([[[1,2], [3,4]], [[5,6], [7,8,9]]]);
+-------------------------------------------------+
| unnest([[[1, 2], [3, 4]], [[5, 6], [7, 8, 9]]]) |
+-------------------------------------------------+
| 1                                               |
| 2                                               |
| 3                                               |
| 4                                               |
| 5                                               |
| 6                                               |
| 7                                               |
| 8                                               |
| 9                                               |
+-------------------------------------------------+

Tracking in #10295

@vercel
Copy link

vercel bot commented Mar 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
databend ⬜️ Ignored (Inspect) Mar 4, 2023 at 4:25AM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Mar 3, 2023
After Unnest Eval
|_____Unnest
      |____Before Unnest Eval
@RinChanNOWWW RinChanNOWWW marked this pull request as ready for review March 4, 2023 03:40
@BohuTANG BohuTANG merged commit 74ea466 into databendlabs:main Mar 4, 2023
@RinChanNOWWW RinChanNOWWW deleted the advanced-unnest branch March 5, 2023 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants