Rich-T-kid commented on code in PR #10840:
URL: https://github.com/apache/arrow-rs/pull/10840#discussion_r3964577400


##########
arrow-schema/src/datatype_parse.rs:
##########
@@ -597,20 +610,52 @@ impl<'a> Parser<'a> {
         }
     }
 
-    /// Parses the next RunEndEncoded (called after `RunEndEncoded` has been 
consumed)
-    /// E.g: RunEndEncoded("run_ends": UInt32, "values": nonnull Int32)
+    /// Parses the next RunEndEncoded (called after `RunEndEncoded` has been 
consumed).
+    ///
+    /// Compact form (default field names): `RunEndEncoded(non-null Int32, 
non-null Utf8)`
+    /// Verbose form (custom field names):  `RunEndEncoded("re": Int32, "v": 
non-null Utf8)`
     fn parse_run_end_encoded(&mut self) -> ArrowResult<DataType> {
         self.expect_token(Token::LParen)?;
-        let run_ends = self.parse_field()?;
-        self.expect_token(Token::Comma)?;
-        let values = self.parse_field()?;
+
+        // Distinguish compact from verbose by peeking: verbose starts with a 
double-quoted name.
+        let verbose = matches!(
+            self.tokenizer.peek(),
+            Some(Ok(Token::DoubleQuotedString(_)))
+        );
+
+        let (run_ends, values) = if verbose {
+            let run_ends = self.parse_ree_verbose_field()?;
+            self.expect_token(Token::Comma)?;
+            let values = self.parse_ree_verbose_field()?;
+            (run_ends.with_nullable(false), values)

Review Comment:
   can also make a follow up for this but I think its a slightly separate 
discussion. Would we want to throw an error here if the run ends are nullable?  



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