tustvold commented on code in PR #2394:
URL: https://github.com/apache/arrow-datafusion/pull/2394#discussion_r865123682
##########
data-access/src/object_store/mod.rs:
##########
@@ -102,3 +132,113 @@ pub trait ObjectStore: Sync + Send + Debug {
/// Get object reader for one file
fn file_reader(&self, file: SizedFile) -> Result<Arc<dyn ObjectReader>>;
}
+
+const GLOB_START_CHARS: [char; 3] = ['?', '*', '['];
+
+/// Determine whether the path contains a globbing character
+fn contains_glob_start_char(path: &str) -> bool {
+ path.chars().any(|c| GLOB_START_CHARS.contains(&c))
+}
+
+/// Filters the file_stream to only contain files that end with suffix
+async fn filter_suffix(
+ file_stream: FileMetaStream,
+ suffix: &str,
+) -> Result<FileMetaStream> {
+ let suffix = suffix.to_owned();
+ Ok(Box::pin(file_stream.filter(move |fr| {
+ let has_suffix = match fr {
+ Ok(f) => f.path().ends_with(&suffix),
+ Err(_) => true,
+ };
+ async move { has_suffix }
+ })))
+}
+
+fn find_longest_search_path_without_glob_pattern(glob_pattern: &str) -> String
{
+ // in case the glob_pattern is not actually a glob pattern, take the
entire thing
+ if !contains_glob_start_char(glob_pattern) {
+ glob_pattern.to_string()
+ } else {
+ // take all the components of the path (left-to-right) which do not
contain a glob pattern
+ let components_in_glob_pattern =
Review Comment:
I don't think you need to collect this iterator
--
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]