Commit 3211f0b
committed
feat(calcite): support window functions, ROW_NUMBER, and register ISNULL
Add AggregateFunction handling in visitWindowFunction to support
aggregate-based window expressions with DISTINCT and ORDER BY keys.
Add translateOrderKeys utility for window ORDER BY translation.
Register row_number in WINDOW_FUNC_MAPPING and skip aggregate
signature validation for it (it has no field/args). Pass distinct
flag through makeOver call chain.
RANK and DENSE_RANK are deferred to a follow-up alongside the open
PPL eventstats/streamstats issue (#5168) which involves the same
function registration and a separate ORDER BY semantics question.
Register ISNULL as alias for IS_NULL in PPLFuncImpTable.
Add integration tests for window functions with ORDER BY,
ROW_NUMBER, COUNT DISTINCT OVER, and ISNULL.
Signed-off-by: Chen Dai <daichen@amazon.com>1 parent 498b25f commit 3211f0b
5 files changed
Lines changed: 139 additions & 10 deletions
File tree
- api/src/test/java/org/opensearch/sql/api
- core/src/main/java/org/opensearch/sql
- calcite
- utils
- expression/function
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
263 | 321 | | |
264 | 322 | | |
265 | 323 | | |
| |||
Lines changed: 63 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| 78 | + | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| |||
563 | 568 | | |
564 | 569 | | |
565 | 570 | | |
566 | | - | |
567 | | - | |
568 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
569 | 590 | | |
570 | 591 | | |
571 | 592 | | |
572 | 593 | | |
573 | 594 | | |
574 | | - | |
| 595 | + | |
| 596 | + | |
575 | 597 | | |
576 | 598 | | |
577 | 599 | | |
578 | 600 | | |
579 | 601 | | |
580 | 602 | | |
581 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
582 | 616 | | |
583 | 617 | | |
584 | 618 | | |
585 | 619 | | |
586 | 620 | | |
587 | 621 | | |
588 | 622 | | |
| 623 | + | |
589 | 624 | | |
590 | 625 | | |
591 | 626 | | |
592 | | - | |
| 627 | + | |
593 | 628 | | |
594 | 629 | | |
595 | 630 | | |
596 | 631 | | |
| 632 | + | |
597 | 633 | | |
598 | 634 | | |
599 | 635 | | |
600 | | - | |
| 636 | + | |
601 | 637 | | |
602 | 638 | | |
603 | 639 | | |
604 | | - | |
605 | | - | |
606 | | - | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
607 | 661 | | |
608 | 662 | | |
609 | 663 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
174 | 187 | | |
175 | 188 | | |
176 | 189 | | |
| |||
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
229 | | - | |
| 242 | + | |
230 | 243 | | |
231 | 244 | | |
232 | 245 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
428 | 429 | | |
429 | 430 | | |
430 | 431 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
1192 | 1193 | | |
1193 | 1194 | | |
1194 | 1195 | | |
| 1196 | + | |
| 1197 | + | |
1195 | 1198 | | |
1196 | 1199 | | |
1197 | 1200 | | |
| |||
0 commit comments