dmitry-chirkov-dremio opened a new issue, #49420:
URL: https://github.com/apache/arrow/issues/49420

   ### Describe the enhancement requested
   
   The `castVARCHAR` functions have several issues:
   
   **Functional issues:**
   - bool - allocates 5 bytes from arena, then immediately overwrites the 
pointer with a string literal; the allocation is never used
   - int32/int64 - missing handling for len=0 (should return empty string) and 
len<0 (should set error)
   
   **Performance issues:**
   - int32/int64 - max output is 11/20 bytes, but allocates len bytes upfront
   - date64 - output is always 10 bytes ("YYYY-MM-DD"), but allocates len bytes
   - float32/float64 - max output is ~15-24 bytes, but allocates len bytes
   
   **Proposed fixes:**
   1. Integer types: Format to stack buffer, allocate only min(len, 
actual_size) bytes, add len<=0 handling
   2. Date/Float types: Allocate only min(len, max_output_size) bytes upfront 
instead of len bytes
   3. Boolean type: Return string literal directly without arena allocation
   4. Tests: Add coverage for len=0 and len<0 edge cases
   
   ### Component(s)
   
   C++, Gandiva


-- 
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]

Reply via email to