ArianaVillegas commented on code in PR #12625:
URL: https://github.com/apache/arrow/pull/12625#discussion_r853360326
##########
cpp/src/arrow/filesystem/filesystem.h:
##########
@@ -122,18 +122,30 @@ ARROW_EXPORT std::ostream& operator<<(std::ostream& os,
const FileInfo&);
/// \brief File selector for filesystem APIs
struct ARROW_EXPORT FileSelector {
- /// The directory in which to select files.
- /// If the path exists but doesn't point to a directory, this should be an
error.
+ /// The path or glob in which to select files.
std::string base_dir;
+ // Selector type of file selector
+ SelectorType type;
/// The behavior if `base_dir` isn't found in the filesystem. If false,
/// an error is returned. If true, an empty selection is returned.
bool allow_not_found;
- /// Whether to recurse into subdirectories.
- bool recursive;
/// The maximum number of subdirectories to recurse into.
int32_t max_recursion;
- FileSelector() : allow_not_found(false), recursive(false),
max_recursion(INT32_MAX) {}
+ FileSelector()
+ : type(SelectorType::Directory), allow_not_found(false),
max_recursion(0) {}
+
+ FileSelector(std::string base_dir, SelectorType type)
+ : base_dir(base_dir), type(type), allow_not_found(false),
max_recursion(0) {}
+
+ bool recursive() const { return (type == SelectorType::Directory &&
max_recursion); }
Review Comment:
Also, if we have this glob: `/A/*/B/`, does it mean a glob directory? So
should we have the same result for `/A/*/B/` and `/A/*/B/**`?
--
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]