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

   **Which part is this question about**
   In our code, there are 3 different `OffsetSizeTrait`: `OffsetSizeTrait`, 
`BinaryOffsetSizeTrait` and `StringOffsetSizeTrait`. The only difference 
between them is that `BinaryOffsetSizeTrait` and `StringOffsetSizeTrait` have a 
const `dataType`. 
   
   My questions are: 
   1. Why do we need three of them? Do we have to declare `dataType` as a const?
   2. Could we just use one `OffsetSizeTrait` and get the `dataType` like this:
   ```rust
   pub struct GenericBinaryArray<OffsetSize: OffsetSizeTrait> {
       data: ArrayData,
       value_offsets: RawPtrBox<OffsetSize>,
       value_data: RawPtrBox<u8>,
   }
   
   impl<OffsetSize: OffsetSizeTrait> GenericBinaryArray<OffsetSize> {
       ...
       pub fn get_datatype() -> DataType {
           if OffsetSize::is_large() {
               DataType::LargeBinary
           } else {
               DataType::Binary
           }
       }
       ...
   }
   ```
   


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