You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AdamGS (via GitHub)" <gi...@apache.org> on 2026/02/02 10:00:04 UTC

[PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

AdamGS opened a new pull request, #9327:
URL: https://github.com/apache/arrow-rs/pull/9327

   # Which issue does this PR close?
   
   
   - Closes https://github.com/apache/arrow-rs/issues/9326
   
   # Rationale for this change
   
   Adds nice utility functions
   
   # What changes are included in this PR?
   
   Two new functions to `DataType`, `is_list` and `is_binary`.
   
   # Are these changes tested?
   
   Two additional tests, one for each function.
   
   # Are there any user-facing changes?
   
   Extends the API surface.
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

Posted by "AdamGS (via GitHub)" <gi...@apache.org>.
AdamGS commented on code in PR #9327:
URL: https://github.com/apache/arrow-rs/pull/9327#discussion_r2753517607


##########
arrow-schema/src/datatype.rs:
##########
@@ -1193,6 +1210,38 @@ mod tests {
         assert!(!DataType::is_null(&DataType::Int32));
     }
 
+    #[test]
+    fn test_is_list() {
+        assert!(DataType::is_list(&DataType::new_list(
+            DataType::Int16,
+            true
+        )));
+        assert!(DataType::is_list(&DataType::new_large_list(
+            DataType::Int16,
+            true
+        )));
+        assert!(DataType::is_list(&DataType::new_fixed_size_list(
+            DataType::Int16,
+            5,
+            true
+        )));
+        assert!(DataType::is_list(&DataType::ListView(Arc::new(
+            Field::new("f", DataType::Int16, true)
+        ))));
+        assert!(DataType::is_list(&DataType::LargeListView(Arc::new(

Review Comment:
   this made me wonder if `DataType::new_list_view` and `DataType::new_large_list_view` are also desired, but that's probably another PR.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9327:
URL: https://github.com/apache/arrow-rs/pull/9327#discussion_r2755206919


##########
arrow-schema/src/datatype.rs:
##########
@@ -648,6 +648,23 @@ impl DataType {
         matches!(self, Utf8 | LargeUtf8 | Utf8View)
     }
 
+    /// Returns true if this type is a List type

Review Comment:
   I recommend we explciitly document here what "List" means so people don't have to look at the code to find out if it is just `List` or also includes `ListView` and `FixedSizeList`
   
   for example
   ```rust
       /// Returns true if this type is a List type
       ///
       /// List types include List, LargeList, FixedSizeList, ListView, and LargeListView
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9327:
URL: https://github.com/apache/arrow-rs/pull/9327#discussion_r2755206919


##########
arrow-schema/src/datatype.rs:
##########
@@ -648,6 +648,23 @@ impl DataType {
         matches!(self, Utf8 | LargeUtf8 | Utf8View)
     }
 
+    /// Returns true if this type is a List type

Review Comment:
   I recommend we explciitly document here what "List" means 
   
   for example
   ```rust
       /// Returns true if this type is a List type
       ///
       /// List types include List, LargeList, FixedSizeList, ListView, and LargeListView
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #9327:
URL: https://github.com/apache/arrow-rs/pull/9327#issuecomment-3842111543

   Thanks @AdamGS and @Jefffrey 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add `DataType::is_list` and `DataType::is_binary` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #9327:
URL: https://github.com/apache/arrow-rs/pull/9327


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org