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(window): initial impl window function #10700

Merged
merged 20 commits into from Mar 28, 2023

Conversation

ariesdevil
Copy link
Member

@ariesdevil ariesdevil commented Mar 21, 2023

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

Summary

initial impl window function

Closes #issue

@vercel
Copy link

vercel bot commented Mar 21, 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 28, 2023 at 9:41AM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Mar 21, 2023
@ariesdevil ariesdevil force-pushed the window-func branch 3 times, most recently from 36ba9e5 to 740a979 Compare March 25, 2023 18:09
@ariesdevil ariesdevil requested review from RinChanNOWWW and removed request for RinChanNOWWW March 25, 2023 18:11
@ariesdevil
Copy link
Member Author

explain plan

mysql> explain select a, sum(b) over(partition by c order by a rows between 3 preceding and 3 following) as s from t;
+------------------------------------------------------------------------------------------------------------------------------+
| explain                                                                                                                      |
+------------------------------------------------------------------------------------------------------------------------------+
| EvalScalar                                                                                                                   |
| ├── expressions: [sum_with_window (#3)]                                                                                      |
| ├── estimated rows: 6.00                                                                                                     |
| └── Window                                                                                                                   |
|     ├── aggregate function: [sum(b)]                                                                                         |
|     ├── partition by: [c]                                                                                                    |
|     ├── order by: [a]                                                                                                        |
|     └── TableScan                                                                                                            |
|         ├── table: default.default.t                                                                                         |
|         ├── read rows: 6                                                                                                     |
|         ├── read bytes: 55                                                                                                   |
|         ├── partitions total: 1                                                                                              |
|         ├── partitions scanned: 1                                                                                            |
|         ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 0 to 0>]       |
|         ├── push downs: [filters: [], limit: NONE]                                                                           |
|         ├── output columns: [a]                                                                                              |
|         └── estimated rows: 6.00                                                                                             |
+------------------------------------------------------------------------------------------------------------------------------+

explain pipeline

mysql> explain pipeline select a, sum(b) over(partition by c order by a rows between 3 preceding and 3 following) as s from t;
+---------------------------------------------------------------------------------------------+
| explain                                                                                     |
+---------------------------------------------------------------------------------------------+
| CompoundBlockOperator(Project) × 1 processor                                                |
|   CompoundBlockOperator(Map) × 1 processor                                                  |
|     Transform Window × 1 processor                                                          |
|       Merge (SortMergeTransform × 16 processors) to (Transform Window × 1)                  |
|         SortMergeTransform × 16 processors                                                  |
|           SortPartialTransform × 16 processors                                              |
|             Merge (DeserializeDataTransform × 1 processor) to (SortPartialTransform × 16)   |
|               DeserializeDataTransform × 1 processor                                        |
|                 SyncReadParquetDataSource × 1 processor                                     |
+---------------------------------------------------------------------------------------------+
9 rows in set (0.02 sec)
Read 0 rows, 0.00 B in 0.004 sec., 0 rows/sec., 0.00 B/sec.

src/query/sql/src/planner/semantic/window_check.rs Outdated Show resolved Hide resolved
src/query/sql/src/planner/semantic/window_check.rs Outdated Show resolved Hide resolved
src/query/sql/src/planner/semantic/window_check.rs Outdated Show resolved Hide resolved
src/query/sql/src/planner/binder/project.rs Outdated Show resolved Hide resolved
src/query/service/src/pipelines/pipeline_builder.rs Outdated Show resolved Hide resolved
@ariesdevil ariesdevil force-pushed the window-func branch 2 times, most recently from 0e30622 to 8bac478 Compare March 28, 2023 02:50
@RinChanNOWWW RinChanNOWWW force-pushed the window-func branch 2 times, most recently from 3ae02fa to e59fb2c Compare March 28, 2023 08:29
@ariesdevil ariesdevil marked this pull request as ready for review March 28, 2023 08:35
@ariesdevil ariesdevil changed the title feat(window): window function feat(window): initial impl window function Mar 28, 2023
@ariesdevil
Copy link
Member Author

ariesdevil commented Mar 28, 2023

FYI: the failed 13_0008_q8.sql in test-stateless-cluster can run successfully on release mode.
related: #10585

@ariesdevil ariesdevil mentioned this pull request Mar 28, 2023
15 tasks
@ariesdevil ariesdevil merged commit 0df493f into datafuselabs:main Mar 28, 2023
43 checks passed
@ariesdevil ariesdevil deleted the window-func branch April 6, 2023 15:08
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.

None yet

3 participants