DKER2 commented on code in PR #11232:
URL: https://github.com/apache/arrow-rs/pull/11232#discussion_r4371154719
##########
parquet-variant/src/utils.rs:
##########
@@ -243,26 +243,33 @@ fn parse_in_bracket(s: &str, i: usize) ->
Result<(VariantPathElement<'_>, usize)
match c {
// Escape: take next char literally
'\\' => {
+ let unescaped =
+ unescaped.get_or_insert_with(||
String::from(&s[start..start + offset]));
if let Some((_, next)) = chars.next() {
unescaped.push(next);
}
// Trailing backslash will be handled as 'unclosed [' below
}
'\'' | '"' if quote == Some(c) => {
quote = None;
- unescaped.push(c);
+ if let Some(unescaped) = &mut unescaped {
+ unescaped.push(c);
Review Comment:
that make sense, change the implementation to count the offset instead. But
the improvement is mainly on CPU utilization as we still need to allocate
memory for a cursor to tracks how far we’ve copied into unescaped.
--
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]