Commit 7cbc6b4
authored
Remove as_any from scalar UDF trait definition (#20812)
## Which issue does this PR close?
None.
## Rationale for this change
This PR reduces the amount of boilerplate code that users need to write
for scalar UDFs. I didn't address aggregate or window functions yet just
to keep the size of the PR manageable.
## What changes are included in this PR?
Now that we have [trait
upcasting](https://blog.rust-lang.org/2025/04/03/Rust-1.86.0/) since
rust 1.86, we no longer need every implementation of `ScalarUDFImpl` to
have the `as_any` function that returns `&self`. This PR makes `Any` an
supertrait for `ScalarUDFImpl` and makes the appropriate casts when
necessary. The overall diff is about 1200 lines of code removed.
## Are these changes tested?
Existing unit tests.
## Are there any user-facing changes?
Users simply need to remove the `as_any()` function from their
implementations.1 parent 4f13319 commit 7cbc6b4
222 files changed
Lines changed: 96 additions & 1260 deletions
File tree
- datafusion-examples/examples
- builtin_functions
- data_io
- query_planning
- udf
- datafusion
- core/tests
- fuzz_cases/equivalence
- physical_optimizer
- user_defined
- expr/src
- ffi/src
- proto
- tests
- udf
- functions-nested/src
- functions/src
- core
- crypto
- datetime
- encoding
- math
- regex
- string
- unicode
- optimizer/src
- analyzer
- simplify_expressions
- test
- physical-expr/src
- utils
- proto/tests/cases
- spark/src/function
- array
- bitmap
- bitwise
- collection
- conditional
- conversion
- datetime
- hash
- json
- map
- math
- string
- url
- sqllogictest/src
- sql
- src/unparser
- tests
- docs/source/library-user-guide
- functions
- upgrading
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 121 | | |
126 | 122 | | |
127 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
207 | 206 | | |
208 | 207 | | |
209 | 208 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 209 | | |
215 | 210 | | |
216 | 211 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | 192 | | |
198 | 193 | | |
199 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 68 | | |
74 | 69 | | |
75 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 163 | | |
168 | 164 | | |
169 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
531 | 530 | | |
532 | 531 | | |
533 | 532 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | 533 | | |
538 | 534 | | |
539 | 535 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 81 | | |
87 | 82 | | |
88 | 83 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 132 | | |
137 | 133 | | |
138 | 134 | | |
| |||
Lines changed: 0 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
201 | 200 | | |
202 | 201 | | |
203 | 202 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | 203 | | |
209 | 204 | | |
210 | 205 | | |
| |||
511 | 506 | | |
512 | 507 | | |
513 | 508 | | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | 509 | | |
519 | 510 | | |
520 | 511 | | |
| |||
678 | 669 | | |
679 | 670 | | |
680 | 671 | | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | 672 | | |
685 | 673 | | |
686 | 674 | | |
| |||
800 | 788 | | |
801 | 789 | | |
802 | 790 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | 791 | | |
807 | 792 | | |
808 | 793 | | |
| |||
949 | 934 | | |
950 | 935 | | |
951 | 936 | | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | 937 | | |
957 | 938 | | |
958 | 939 | | |
| |||
1441 | 1422 | | |
1442 | 1423 | | |
1443 | 1424 | | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | 1425 | | |
1449 | 1426 | | |
1450 | 1427 | | |
| |||
1609 | 1586 | | |
1610 | 1587 | | |
1611 | 1588 | | |
1612 | | - | |
1613 | | - | |
1614 | | - | |
1615 | | - | |
1616 | 1589 | | |
1617 | 1590 | | |
1618 | 1591 | | |
| |||
1818 | 1791 | | |
1819 | 1792 | | |
1820 | 1793 | | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | 1794 | | |
1826 | 1795 | | |
1827 | 1796 | | |
| |||
1988 | 1957 | | |
1989 | 1958 | | |
1990 | 1959 | | |
1991 | | - | |
1992 | | - | |
1993 | | - | |
1994 | 1960 | | |
1995 | 1961 | | |
1996 | 1962 | | |
| |||
2052 | 2018 | | |
2053 | 2019 | | |
2054 | 2020 | | |
2055 | | - | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | 2021 | | |
2060 | 2022 | | |
2061 | 2023 | | |
| |||
2133 | 2095 | | |
2134 | 2096 | | |
2135 | 2097 | | |
2136 | | - | |
2137 | | - | |
2138 | | - | |
2139 | | - | |
2140 | 2098 | | |
2141 | 2099 | | |
2142 | 2100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | 105 | | |
110 | 106 | | |
111 | 107 | | |
| |||
156 | 152 | | |
157 | 153 | | |
158 | 154 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 155 | | |
164 | 156 | | |
165 | 157 | | |
| |||
193 | 185 | | |
194 | 186 | | |
195 | 187 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 188 | | |
201 | 189 | | |
202 | 190 | | |
| |||
0 commit comments