Commit 469f18b
authored
function: Allow more expressive array signatures (#14532)
* function: Allow more expressive array signatures
This commit allows for more expressive array function signatures.
Previously, `ArrayFunctionSignature` was an enum of potential argument
combinations and orders. For many array functions, none of the
`ArrayFunctionSignature` variants worked, so they used
`TypeSignature::VariadicAny` instead. This commit will allow those
functions to use more descriptive signatures which will prevent them
from having to perform manual type checking in the function
implementation.
As an example, this commit also updates the signature of the
`array_replace` family of functions to use a new expressive signature,
which removes a panic that existed previously.
There are still a couple of limitations with this approach. First of
all, there's no way to describe a function that has multiple different
arrays of different type or dimension. Additionally, there isn't
support for functions with map arrays and recursive arrays that have
more than one argument.
Works towards resolving #14451
* Add mutability
* Move mutability enum
* fmt
* Fix doctest
* Add validation to array args
* Remove mutability and update return types
* fmt
* Fix clippy
* Fix imports
* Add list coercion flag
* Some formatting fixes
* Some formatting fixes
* Remove ArrayFunctionArguments struct
* Simplify helper functions
* Update array_and_element behavior1 parent e11a8ca commit 469f18b
File tree
9 files changed
+352
-186
lines changed- datafusion
- common/src/utils
- expr-common/src
- expr/src
- type_coercion
- functions-nested/src
- sqllogictest/test_files
9 files changed
+352
-186
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
593 | 600 | | |
594 | 601 | | |
595 | 602 | | |
| |||
600 | 607 | | |
601 | 608 | | |
602 | 609 | | |
603 | | - | |
| 610 | + | |
604 | 611 | | |
605 | 612 | | |
606 | 613 | | |
607 | 614 | | |
| 615 | + | |
608 | 616 | | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
613 | 626 | | |
614 | 627 | | |
615 | 628 | | |
616 | 629 | | |
617 | 630 | | |
618 | 631 | | |
619 | 632 | | |
620 | | - | |
621 | | - | |
622 | | - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
623 | 651 | | |
624 | 652 | | |
625 | 653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
249 | 237 | | |
250 | 238 | | |
251 | 239 | | |
| |||
257 | 245 | | |
258 | 246 | | |
259 | 247 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
273 | 254 | | |
274 | 255 | | |
275 | 256 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | 257 | | |
280 | 258 | | |
281 | 259 | | |
| |||
286 | 264 | | |
287 | 265 | | |
288 | 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 | + | |
289 | 295 | | |
290 | 296 | | |
291 | 297 | | |
| |||
580 | 586 | | |
581 | 587 | | |
582 | 588 | | |
583 | | - | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
584 | 596 | | |
585 | 597 | | |
586 | 598 | | |
587 | 599 | | |
588 | 600 | | |
589 | 601 | | |
590 | 602 | | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
603 | 620 | | |
604 | 621 | | |
605 | 622 | | |
| 623 | + | |
606 | 624 | | |
607 | 625 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | 626 | | |
613 | 627 | | |
614 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
615 | 635 | | |
616 | 636 | | |
617 | 637 | | |
618 | 638 | | |
619 | 639 | | |
620 | 640 | | |
621 | 641 | | |
622 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
623 | 648 | | |
624 | 649 | | |
625 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
0 commit comments