This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 884de44d9 Minor: simplify the function `GenericListArray::get_type` 
(#1650)
884de44d9 is described below

commit 884de44d9b228fdf6f693680207e35f0ed5ec590
Author: Remzi Yang <[email protected]>
AuthorDate: Fri May 6 03:04:43 2022 +0800

    Minor: simplify the function `GenericListArray::get_type` (#1650)
    
    * simplify the code
    
    Signed-off-by: remzi <[email protected]>
    
    * correct the format
    
    Signed-off-by: remzi <[email protected]>
---
 arrow/src/array/array_list.rs | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arrow/src/array/array_list.rs b/arrow/src/array/array_list.rs
index acfc8e932..e86227ac8 100644
--- a/arrow/src/array/array_list.rs
+++ b/arrow/src/array/array_list.rs
@@ -118,16 +118,11 @@ impl<OffsetSize: OffsetSizeTrait> 
GenericListArray<OffsetSize> {
 
     #[inline]
     fn get_type(data_type: &DataType) -> Option<&DataType> {
-        if OffsetSize::is_large() {
-            if let DataType::LargeList(child) = data_type {
+        match (OffsetSize::is_large(), data_type) {
+            (true, DataType::LargeList(child)) | (false, 
DataType::List(child)) => {
                 Some(child.data_type())
-            } else {
-                None
             }
-        } else if let DataType::List(child) = data_type {
-            Some(child.data_type())
-        } else {
-            None
+            _ => None,
         }
     }
 

Reply via email to