alamb opened a new issue, #17152:
URL: https://github.com/apache/datafusion/issues/17152

   ### Is your feature request related to a problem or challenge?
   
   - While reviewing https://github.com/apache/datafusion/pull/15361 I noticed 
that the `to_char` implementation for arrays could likely be improved 
substntially
   
   Specifically the code that 
   
   The use of `Vec<Option<String>>` to build a string array is non ideal as it 
requires additional allocations for each output row along with a second copy of 
the data
   
   ```rust
   fn to_char_array(args: &[ColumnarValue]) -> Result<ColumnarValue> {
       let arrays = ColumnarValue::values_to_arrays(args)?;
       let mut results: Vec<Option<String>> = vec![]; // <--- this is non ideal
   ```
   
   Also, the code that falls back to date formatting calls `cast` for a single 
row every time the formatting fails -- since the failure is likely due to a 
date specifier that will get called for all rows, it would probably be faster 
to convert the entire input array to `Date` once the first time the specifier 
is retried
   
   ### Describe the solution you'd like
   
   Make to_char faster
   
   You can evaluate your changes with the existing benchmark
   ```shell
   cargo bench --bench to_char
   ```
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to