jackwener commented on code in PR #7091:
URL: https://github.com/apache/arrow-datafusion/pull/7091#discussion_r1275766410


##########
datafusion/proto/src/common.rs:
##########
@@ -17,26 +17,22 @@
 
 use datafusion_common::{DataFusionError, Result};
 
-pub fn csv_delimiter_to_string(b: u8) -> Result<String> {
-    let b = &[b];
-    let b = std::str::from_utf8(b)
-        .map_err(|_| DataFusionError::Internal("Invalid CSV 
delimiter".to_owned()))?;
-    Ok(b.to_owned())
-}
-
-pub fn str_to_byte(s: &String) -> Result<u8> {
+pub(crate) fn str_to_byte(s: &String, description: &str) -> Result<u8> {
     if s.len() != 1 {
-        return Err(DataFusionError::Internal(
-            "Invalid CSV delimiter".to_owned(),
-        ));
+        return Err(DataFusionError::Internal(format!(
+            "Invalid CSV {description}: expected single character, got {s}"
+        )));
     }
     Ok(s.as_bytes()[0])
 }
 
-pub fn byte_to_string(b: u8) -> Result<String> {
+pub fn byte_to_string(b: u8, description: &str) -> Result<String> {

Review Comment:
   ```suggestion
   pub(crate) fn byte_to_string(b: u8, description: &str) -> Result<String> {
   ```



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