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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   In the `arrow-array/src/array/union_array.rs` file the 
`UnionArray::is_dense` method is currently private. Because this method is 
private, the `arrow-avro` `Encoder` requires additional complexity to support 
Union type encoding to route between Sparse and Dense Union types.
   
   By having `UnionArray::is_dense` public, we could simplify this and just 
call `is_dense` in the `UnionEncoder` constructor method.
   
   **Describe the solution you'd like**
   
   In `arrow-array/src/array/union_array.rs`:
   
   `fn is_dense(&self)` -> `pub fn is_dense(&self)`
   
   **Describe alternatives you've considered**
   
   Re-implementing the same logic inside of the `arrow-avro` `Encoder`, i.e.
   
   **Additional context**
   
   1. Without Change
   
   ```rust
           let DataType::Union(fields, UnionMode::Dense) = array.data_type() 
else {
               return Err(ArrowError::SchemaError("Expected Dense 
UnionArray".into()));
           };
   ```
   
   2. With Change
   ```rust
           if !array.is_dense() {
               return Err(ArrowError::SchemaError("Expected Dense 
UnionArray".into()));
           }
   ```
   


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