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

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   -->
   
   I've noticed that `parse_in_bracket` in `parquet-variant/src/utils.rs` 
always allocates a `String` when parsing bracket expressions like `[field]` or 
`[0]`, even when no escaping is needed:
   
   ```rust
   fn parse_in_bracket(s: &str, i: usize) -> Result<(VariantPathElement<'_>, 
usize), ArrowError> {
       let start = i + 1;
       let mut unescaped = String::new();  // <-- Always allocates!
       // ...
   }
   ```
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   I'm thinking of optimizing this by:
   
   1. Check if the content contains `\` before allocating
   2. Since `VariantPathElement` already supports `Cow<'a, str>`, we could 
borrow the slice directly when no escaping is present
   3.  Only allocate when we actually encounter escape sequences


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