Commit a840049
committed
ORCA: Introduce hash windows aggregation when use the vectorization exector
In this PR, ORCA now supports generating `WindowHashAgg` plans which already
have implementation in the vectorization executor. However, the CBDB row executor
currently lacks implementation for the WindowHashAgg operator. To prevent ORCA
from generating this operator in the row executor, I've added an struct which named
`OptimizerOptions` to control the plan for row executor or vectorization executor.
(By the way, ORCA may later generate plans specifically for the vectorization executor).
The `WindowAgg` operator implemention in the vectorization execution is:
1. First, sorting the input rows by `ORDER BY` keys
2. Then do the `PARTITION` by `PARTITION BY` keys
3. Finally do the window function.
Since step1 must be globally sorted, it cannot be parallelized in the vectorization executor.
This results in poor performance of the `WindowAgg` operator.
By contrast, `WindowHashAgg` employs a more efficient approach:
1. First hashes input data into buckets based on `PARTITION BY` keys
2. Then sorts data `within each bucket` according to `ORDER BY` keys
3. Finally computes window functions on the sorted bucket data
For the row engine, `WindowHashAgg` operators will not be generated.
Also current commit introduces a new GUC named `optimizer_force_window_hash_agg`
to force generate plans with `WindowHashAgg` (Don't used this GUC expect debug ORCA).
Co-Author-By: zhangyue <zhangyue@hashdata.cn>1 parent 8b01eaf commit a840049
File tree
60 files changed
+1264
-156
lines changed- contrib/pg_stat_statements
- gpcontrib/pg_hint_plan
- src
- backend
- cdb
- gpopt
- config
- translate
- utils
- gporca
- libgpdbcost
- include/gpdbcost
- src
- libgpopt
- include/gpopt
- base
- operators
- translate
- xforms
- src
- base
- operators
- translate
- xforms
- libnaucrates
- include/naucrates
- dxl
- operators
- xml
- traceflags
- src
- operators
- parser
- xml
- nodes
- optimizer
- plan
- util
- utils
- misc
- resource_manager
- include
- gpopt
- config
- translate
- utils
- nodes
- optimizer
- utils
- test
- modules/delay_execution
- regress/hooktest
- unit/mock
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
60 files changed
+1264
-156
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
| 316 | + | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
| |||
866 | 867 | | |
867 | 868 | | |
868 | 869 | | |
869 | | - | |
| 870 | + | |
| 871 | + | |
870 | 872 | | |
871 | 873 | | |
872 | 874 | | |
| |||
908 | 910 | | |
909 | 911 | | |
910 | 912 | | |
911 | | - | |
| 913 | + | |
912 | 914 | | |
913 | 915 | | |
914 | | - | |
| 916 | + | |
915 | 917 | | |
916 | 918 | | |
917 | 919 | | |
| |||
945 | 947 | | |
946 | 948 | | |
947 | 949 | | |
948 | | - | |
| 950 | + | |
949 | 951 | | |
950 | 952 | | |
951 | | - | |
| 953 | + | |
952 | 954 | | |
953 | 955 | | |
954 | 956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| |||
3118 | 3118 | | |
3119 | 3119 | | |
3120 | 3120 | | |
3121 | | - | |
| 3121 | + | |
3122 | 3122 | | |
3123 | 3123 | | |
3124 | 3124 | | |
| |||
3236 | 3236 | | |
3237 | 3237 | | |
3238 | 3238 | | |
3239 | | - | |
| 3239 | + | |
3240 | 3240 | | |
3241 | | - | |
| 3241 | + | |
3242 | 3242 | | |
3243 | 3243 | | |
3244 | 3244 | | |
| |||
3298 | 3298 | | |
3299 | 3299 | | |
3300 | 3300 | | |
3301 | | - | |
| 3301 | + | |
3302 | 3302 | | |
3303 | | - | |
| 3303 | + | |
3304 | 3304 | | |
3305 | 3305 | | |
3306 | 3306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
| 1509 | + | |
1509 | 1510 | | |
1510 | 1511 | | |
1511 | 1512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
697 | 716 | | |
698 | 717 | | |
699 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
525 | 526 | | |
526 | 527 | | |
527 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | | - | |
| 203 | + | |
203 | 204 | | |
204 | | - | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
| |||
339 | 345 | | |
340 | 346 | | |
341 | 347 | | |
342 | | - | |
| 348 | + | |
| 349 | + | |
343 | 350 | | |
344 | 351 | | |
345 | 352 | | |
| |||
561 | 568 | | |
562 | 569 | | |
563 | 570 | | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
564 | 575 | | |
565 | 576 | | |
566 | 577 | | |
| |||
0 commit comments