Commit e1a5cdf
Support multiple ordered
* Validate states shape in merge_batch
Due to `..` in the pattern, the
`OrderSensitiveArrayAggAccumulator::merge_batch` did not validate it's
not receiving additional states columns it ignores. Update the code to
check number of inputs.
* Support multiple ordered array_agg
Before the change, `array_agg` with ordering would depend on input being
ordered. As a result, it was impossible to do two or more `array_agg(x
ORDER BY ...)` with incompatible ordering. This change moves ordering
responsibility into `OrderSensitiveArrayAggAccumulator`. When input is
pre-ordered (beneficial ordering), no additional work is done. However,
when it's not, `array_agg` accumulator will order the data on its own.
* Generate sorts based on aggregations soft requirements
The sorting consideration before aggregations did respect only ordered
aggregation functions with `AggregateOrderSensitivity::HardRequirement`.
This change includes sorting expectations from
`AggregateOrderSensitivity::Beneficial` functions. When beneficial
ordered function requirements are not satisfied, no error is raised,
they are considered in the second pass only.
* Fix reversing first_value, last_value
Upon reversing, a schema and field mismatch would happen.
* Revert "Fix reversing first_value, last_value"
This reverts commit 9b7e94d.
* sort array_agg input the old way whenever possible
* revert some now unnecessary change
* Improve doc for SoftRequiement
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* Add comment for include_soft_requirement
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
* Document include_soft_requirement param
* fmt
* doc fix
---------
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>array_agg aggregations (#16625)1 parent c6d5520 commit e1a5cdf
File tree
6 files changed
+222
-62
lines changed- datafusion
- ffi/src/udaf
- functions-aggregate-common/src
- functions-aggregate/src
- physical-plan/src/aggregates
- sqllogictest/test_files
6 files changed
+222
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
| |||
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| 601 | + | |
600 | 602 | | |
601 | 603 | | |
602 | 604 | | |
| |||
607 | 609 | | |
608 | 610 | | |
609 | 611 | | |
| 612 | + | |
610 | 613 | | |
611 | 614 | | |
612 | 615 | | |
| |||
748 | 751 | | |
749 | 752 | | |
750 | 753 | | |
| 754 | + | |
751 | 755 | | |
752 | 756 | | |
753 | 757 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
28 | 39 | | |
29 | 40 | | |
30 | 41 | | |
| |||
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
41 | | - | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
147 | 166 | | |
148 | 167 | | |
149 | 168 | | |
| |||
196 | 215 | | |
197 | 216 | | |
198 | 217 | | |
| 218 | + | |
199 | 219 | | |
200 | 220 | | |
201 | 221 | | |
| |||
518 | 538 | | |
519 | 539 | | |
520 | 540 | | |
| 541 | + | |
| 542 | + | |
521 | 543 | | |
522 | 544 | | |
523 | 545 | | |
| |||
531 | 553 | | |
532 | 554 | | |
533 | 555 | | |
| 556 | + | |
534 | 557 | | |
535 | 558 | | |
536 | 559 | | |
| |||
541 | 564 | | |
542 | 565 | | |
543 | 566 | | |
| 567 | + | |
544 | 568 | | |
545 | 569 | | |
546 | 570 | | |
547 | 571 | | |
548 | 572 | | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
549 | 595 | | |
550 | 596 | | |
551 | 597 | | |
| |||
616 | 662 | | |
617 | 663 | | |
618 | 664 | | |
619 | | - | |
620 | | - | |
621 | | - | |
| 665 | + | |
| 666 | + | |
622 | 667 | | |
623 | 668 | | |
624 | 669 | | |
| |||
629 | 674 | | |
630 | 675 | | |
631 | 676 | | |
632 | | - | |
633 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
634 | 682 | | |
635 | 683 | | |
636 | 684 | | |
| |||
679 | 727 | | |
680 | 728 | | |
681 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
682 | 734 | | |
683 | 735 | | |
684 | 736 | | |
685 | 737 | | |
686 | 738 | | |
687 | 739 | | |
688 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
689 | 745 | | |
690 | 746 | | |
691 | 747 | | |
| |||
0 commit comments