Commit 4f4e814
authored
perf: Optimize concat()/concat_ws() UDFs (#20317)
## Which issue does this PR close?
- Closes #20316.
## Rationale for this change
Faster is better.
## What changes are included in this PR?
This commit implements three optimizations:
* In `StringViewArrayBuilder`, we recreated `block` after every call to
`append_offset`. It is cheaper to instead clear and re-use `block`.
* In `StringViewArrayBuilder::write()`, we re-validated that a string
array consists of valid UTF8 characters. This was unnecessary work and
can be skipped.
* In the concat() UDF implementation, we miscalculated the initial size
of the StringViewArrayBuilder buffer. This didn't lead to incorrect
behavior but it resulted in unnecessarily needing to reallocate the
buffer.
## Are these changes tested?
Yes; no additional test cases warranted.
## Are there any user-facing changes?
No.1 parent c699361 commit 4f4e814
File tree
3 files changed
+12
-17
lines changed- datafusion/functions/src
- string
3 files changed
+12
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
| 155 | + | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 160 | + | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
168 | 164 | | |
169 | | - | |
170 | | - | |
171 | | - | |
| 165 | + | |
172 | 166 | | |
173 | 167 | | |
174 | 168 | | |
175 | | - | |
176 | | - | |
| 169 | + | |
177 | 170 | | |
178 | 171 | | |
179 | | - | |
180 | | - | |
| 172 | + | |
181 | 173 | | |
182 | 174 | | |
183 | | - | |
184 | | - | |
| 175 | + | |
185 | 176 | | |
186 | 177 | | |
187 | 178 | | |
188 | 179 | | |
189 | 180 | | |
190 | 181 | | |
191 | | - | |
| 182 | + | |
192 | 183 | | |
193 | 184 | | |
194 | 185 | | |
| |||
0 commit comments