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

   ## Which issue does this PR close?
   
   Closes #15986
   
   ## Rationale for this change
   
   The current `hex` function implementation uses `write!(&mut s, "{b:02x}")` 
for each byte, which has significant overhead from format string parsing.
   
   ## What changes are included in this PR?
   
   Replaced the slow format-based hex encoding with pre-computed lookup tables 
(HEX_UPPER/HEX_LOWER). Each byte value maps directly to its two-character hex 
representation via simple array indexing.
   
   Benefits:
   - Eliminates format string parsing overhead
   - Uses a single pre-sized allocation
   - Simple array indexing instead of function calls per byte
   
   ## How are these changes tested?
   
   All existing tests pass:
   - test_hex_int64
   - test_spark_hex_int64
   - test_dictionary_hex_utf8
   - test_dictionary_hex_int64
   - test_dictionary_hex_binary
   
   ## Are these changes safe?
   
   Yes - the lookup tables contain only valid ASCII hex characters, so the 
conversion is safe. The behavior is identical to before, just faster.


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