File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,11 @@ LsObjects LocalFilesystem::ls_filtered_v2(
126126
127127Status LocalFilesystem::ls (
128128 const std::string& path, std::vector<std::string>* paths) const {
129+ // Noop if the parent ` path ` is not a directory, do not error out.
130+ if (!is_dir (URI (path))) {
131+ return Status::Ok ();
132+ }
133+
129134 for (auto & fs : ls_with_sizes (URI (path), false )) {
130135 paths->emplace_back (fs.path ().native ());
131136 }
Original file line number Diff line number Diff line change @@ -364,12 +364,21 @@ bool VFS::is_bucket(const URI& uri) const {
364364Status VFS::ls (const URI& parent, std::vector<URI>* uris) const {
365365 stats_->add_counter (" ls_num" , 1 );
366366
367- const auto entries = parent.is_file () ? local_.ls_with_sizes (parent, false ) :
368- ls_with_sizes (parent);
367+ auto entries = parent.is_file () ? local_.ls_with_sizes (parent, false ) :
368+ ls_with_sizes (parent);
369+ if (parent.is_file ()) {
370+ parallel_sort (
371+ compute_tp_,
372+ entries.begin (),
373+ entries.end (),
374+ [](const directory_entry& l, const directory_entry& r) {
375+ return l.path ().native () < r.path ().native ();
376+ });
377+ }
378+
369379 for (const auto & fs : entries) {
370380 uris->emplace_back (fs.path ().native ());
371381 }
372-
373382 return Status::Ok ();
374383}
375384
You can’t perform that action at this time.
0 commit comments