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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   Right now `DataType::Null` is considered incompatible with any data type 
other than `Null`, however it can be naturally merged with any data type, 
possibly widening it to be `nullable`.
   
   **Describe the solution you'd like**
   The logic in this unit-test should be implemented: letting null be merge 
with any type, marking `nullable` as true.
   
   ```rust
       #[test]
       fn test_merge_with_null() {
           let mut field1 = Field::new("c1", DataType::Null, true);
           field1
               .try_merge(&Field::new("c1", DataType::Float32, false))
               .expect("should widen type to nullable float");
           assert_eq!(Field::new("c1", DataType::Float32, true), field1);
   
           let mut field2 = Field::new("c2", DataType::Utf8, false);
           field2
               .try_merge(&Field::new("c2", DataType::Null, true))
               .expect("should widen type to nullable utf8");
           assert_eq!(Field::new("c2", DataType::Utf8, true), field2);
       }
   ```
   
   **Describe alternatives you've considered**
   to achieve the same user now needs to re-implement merge operation
   
   **Additional context**
   Note that merging schemas already allows some degree of logical widening of 
data types, since it will accept same type with and without `nullable` adding 
it in the result.
   
   


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