You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "etseidl (via GitHub)" <gi...@apache.org> on 2025/11/19 20:32:21 UTC

Re: [PR] Support parsing for old style FixedSizeList [arrow-rs]

etseidl commented on code in PR #8882:
URL: https://github.com/apache/arrow-rs/pull/8882#discussion_r2543471478


##########
arrow-schema/src/datatype_parse.rs:
##########
@@ -173,14 +173,35 @@ impl<'a> Parser<'a> {
     }
 
     /// Parses the FixedSizeList type (called after `FixedSizeList` has been consumed)
-    /// E.g: FixedSizeList(5 x nullable Int64, field: 'foo')
+    ///
+    /// Examples:
+    /// * `FixedSizeList(5 x nullable Int64, field: 'foo')`
+    /// * `FixedSizeList(4, Int64)`

Review Comment:
   New to this code...should `FixedSizeList(5 x Int64)` also parse and produce a list with non-nullable elements?



##########
arrow-schema/src/datatype_parse.rs:
##########
@@ -173,14 +173,35 @@ impl<'a> Parser<'a> {
     }
 
     /// Parses the FixedSizeList type (called after `FixedSizeList` has been consumed)
-    /// E.g: FixedSizeList(5 x nullable Int64, field: 'foo')
+    ///
+    /// Examples:
+    /// * `FixedSizeList(5 x nullable Int64, field: 'foo')`
+    /// * `FixedSizeList(4, Int64)`
+    ///
     fn parse_fixed_size_list(&mut self) -> ArrowResult<DataType> {
         self.expect_token(Token::LParen)?;
         let length = self.parse_i32("FixedSizeList")?;
-        self.expect_token(Token::X)?;
-        let field = self.parse_list_field("FixedSizeList")?;
-        self.expect_token(Token::RParen)?;
-        Ok(DataType::FixedSizeList(Arc::new(field), length))
+        match self.next_token()? {
+            // `FixedSizeList(5 x nullable Int64, field: 'foo')` format
+            Token::X => {
+                let field = self.parse_list_field("FixedSizeList")?;
+                self.expect_token(Token::RParen)?;
+                Ok(DataType::FixedSizeList(Arc::new(field), length))
+            }
+            // `FixedSizeList(4, Int64)` format
+            Token::Comma => {
+                let data_type = self.parse_next_type()?;

Review Comment:
   I checked the original code and this seems correct to me.



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