neilconway opened a new pull request, #20305:
URL: https://github.com/apache/datafusion/pull/20305

   ## Which issue does this PR close?
   
   - Closes #20302.
   
   ## Rationale for this change
   
   The `translate()` is commonly invoked with constant values for its second 
and third arguments. We can take advantage of that to significantly optimize 
its performance by precomputing the translation lookup table, rather than 
recomputing it for every row. For scalar ASCII inputs, this yields roughly a 
10x performance improvement. For scalar UTF8 inputs, the performance 
improvement is more like 50%, although less so for long strings.
   
   ## What changes are included in this PR?
   
   * Add a benchmark for scalar/constant input to translate
   * Add a missing test case
   * Improve translate() docs
   * Support translate() on LargeUtf8 input (AFAICS there is no reason this 
shouldn't be supported?)
   * Optimize translate() for scalar inputs by precomputing lookup hashmap
   * Optimize translate() for ASCII inputs by precomputing ASCII byte-wise 
lookup table
   
   ## Are these changes tested?
   
   Yes. Added an extra test case and did a bunch of benchmarking.
   
   ## Are there any user-facing changes?
   
   No.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to