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

   ### Is your feature request related to a problem or challenge?
   
   The current implementation of `chr` explicitly rejects the null character. 
There's a comment in the code stating that "chr(0) is disallowed because text 
data types cannot store that character". As far as I can tell, Rust has no 
issue with this, nor do Arrow UTF-8 arrays.
   
   A quick check with SQLite shows that it is allowed there, but (not entirely 
unexpected) ends up truncating the string when it is printed. Converting to 
hexadecimal does show that the complete string is retained and can be processed 
fine by SQLite.
   ```
   sqlite> select hex('A' || char(0) || 'Z');
   41005A
   sqlite> select 'A' || char(0) || 'Z';
   A
   ```
   
   DuckDB also allows the null character and does better when printing.
   ```
   D select chr(0);
   ┌─────────┐
   │ chr(0)  │
   │ varchar │
   ├─────────┤
   │ \0      │
   └─────────┘
   ```
   
   ### Describe the solution you'd like
   
   Relax the null character restriction in the `chr` implementation.
   
   ### Describe alternatives you've considered
   
   N/A
   
   ### 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