Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of REPEAT functions #11990

Closed
alamb opened this issue Aug 14, 2024 · 2 comments · Fixed by #12015
Closed

Improve performance of REPEAT functions #11990

alamb opened this issue Aug 14, 2024 · 2 comments · Fixed by #12015
Assignees

Comments

@alamb
Copy link
Contributor

alamb commented Aug 14, 2024

          I think you could make this perform much better by avoiding the `String` and instead building the output directly with `StringViewBuilder` 

https://docs.rs/arrow/latest/arrow/array/type.StringViewBuilder.html

here is an example of how to use them: apache/arrow-rs#6240

I realize this just follows the same model as was here. However, if we are messing with the code it might be nice to make it faster while we are at it

Originally posted by @alamb in #11962 (comment)

The idea would be to

  1. Create a benchmark for the REPEAT function for StringArray, LargeStringArray and StringViewArray
  2. Optimize the performance of REPEAT (likely by not creating Strings but instead creating the values directly into a StringBuilder / StringViewArray builder somehow

Benchmarks:

Benchmarks likely would go into https://github.com/apache/datafusion/blob/main/datafusion/functions/benches follow the model of an existing one (e.g. ltrim.rs).

@tlm365
Copy link
Contributor

tlm365 commented Aug 14, 2024

take

@alamb
Copy link
Contributor Author

alamb commented Aug 14, 2024

FWIW #11987 from @Omega359 is a good example of this type of optimization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants