alamb opened a new issue, #7048:
URL: https://github.com/apache/arrow-rs/issues/7048

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   Often we would like to display DataTypes as part of an error message in 
DataFusion
   
   The documentation 
([link](https://docs.rs/arrow/latest/arrow/datatypes/enum.DataType.html#display-and-fromstr))
 says
   
   > The Display and FromStr implementations for DataType are human-readable, 
parseable, and reversible.
   
   However this is not the case for ListArray
   
   In https://github.com/apache/datafusion/pull/14378  I made what looks like 
it should be a nice error message
   
   ```rust
   format!("It is not possible to concatenate arrays of different types. 
Expected: {}, got: {}", expr_type, arg_type)
   ```
   
   However, what comes out is is 🤮 
   
   > query error DataFusion error: Error during planning: It is not possible to 
concatenate arrays of different types\. Expected: List\(Field \{ name: "item", 
data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: 
\{\} \}\), got: List\(Field \{ name: "item", data_type: LargeUtf8, nullable: 
true, dict_id: 0, dict_is_ordered: false, metadata: \{\} \}\)
   
   **Describe the solution you'd like**
   I would like a way to get a nicer human readable version of this for error 
messages
   
   Soemthing like 
   
   > Expected: List\(Utf8;N), got: List\(LargeUtf8;N)
   
   Where the `N` stands for nullable
   
   **Describe alternatives you've considered**
   
   I personally recommend
   1. Explicitly implemeting `Display` for `DataType::List`
   2. Don't print out any information that is the default (e.g if the field 
name is "item" then don't print it)
   
   Right now it simply uses the `Debug` implementation: 
https://github.com/apache/arrow-rs/blob/3bf29a2c7474e59722d885cd11fafd0dca13a28e/arrow-schema/src/datatype.rs#L460-L462
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


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