You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/05/03 21:23:45 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4164: Faster prefix match

tustvold commented on code in PR #4164:
URL: https://github.com/apache/arrow-rs/pull/4164#discussion_r1184303769


##########
object_store/src/path/mod.rs:
##########
@@ -227,14 +227,9 @@ impl Path {
 
     /// Returns the [`PathPart`] of this [`Path`]
     pub fn parts(&self) -> impl Iterator<Item = PathPart<'_>> {
-        match self.raw.is_empty() {
-            true => itertools::Either::Left(std::iter::empty()),
-            false => itertools::Either::Right(
-                self.raw
-                    .split(DELIMITER)
-                    .map(|s| PathPart { raw: s.into() }),
-            ),
-        }
+        self.raw
+            .split_terminator(DELIMITER)

Review Comment:
   This construction is equivalent because we prevent paths from containing empty parts, so split_terminator just handles the empty string case



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