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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   There are lots of places in our code when we need to build the data type for 
a list array:
   ```rust
   let data_type = if OffsetSize::IS_LARGE {
       DataType::LargeList(field)
   } else {
       DataType::List(field)
   };
   ```
   We judge the `OffsetSize` at runtime (I am not sure whether the LLVM could 
do constant folding on it), however, this computation could be done at compile 
time.
   
   **Describe the solution you'd like**
   Add a constant value for List array:
   ```rust
   const DATA_TYPE_CONSTRUCTOR: fn(Box<Field>) -> DataType = 
       if OffsetSize::IS_LARGE { DataType::LargeList} else {DataType::List}
   ```
   
   Then we can simplify the code to get the data type at runtime:
   ```rust
   let data_type = Self::DATA_TYPE_CONSTRUCTOR(field);
   ```
   
   **Describe alternatives you've considered**
   We could not do this.
   
   **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