Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::GlobMultiFileList Class Reference

MultiFileList that takes a list of globs and resolves all of the globs lazily into files. More...

Inheritance diagram for duckdb::GlobMultiFileList:
Collaboration diagram for duckdb::GlobMultiFileList:

Public Member Functions

 GlobMultiFileList (ClientContext &context, vector< string > globs, FileGlobInput input)
vector< OpenFileInfo > GetDisplayFileList (optional_idx max_files=optional_idx()) const override
Public Member Functions inherited from duckdb::LazyMultiFileList
 LazyMultiFileList (optional_ptr< ClientContext > context)
vector< OpenFileInfo > GetAllFiles () const override
FileExpandResult GetExpandResult () const override
idx_t GetTotalFileCount () const override
 Get the total file count - forces all files to be expanded / known so the exact count can be computed.
MultiFileCount GetFileCount (idx_t min_exact_count=0) const override
Public Member Functions inherited from duckdb::MultiFileList
MultiFileListIterationHelper Files () const
 Get Iterator over the files for pretty for loops.
void InitializeScan (MultiFileListScanData &iterator) const
 Initialize a sequential scan over a file list.
bool Scan (MultiFileListScanData &iterator, OpenFileInfo &result_file) const
 Scan the next file into result_file, returns false when out of files.
OpenFileInfo GetFirstFile () const
 Returns the first file or an empty string if GetTotalFileCount() == 0.
bool IsEmpty () const
 Syntactic sugar for GetExpandResult() == FileExpandResult::NO_FILES.
virtual unique_ptr< MultiFileList > ComplexFilterPushdown (ClientContext &context, const MultiFileOptions &options, MultiFilePushdownInfo &info, vector< unique_ptr< Expression > > &filters) const
 Virtual functions for subclasses.
virtual unique_ptr< MultiFileList > DynamicFilterPushdown (ClientContext &context, const MultiFileOptions &options, const vector< string > &names, const vector< LogicalType > &types, const vector< column_t > &column_ids, TableFilterSet &filters) const
virtual unique_ptr< NodeStatistics > GetCardinality (ClientContext &context) const
virtual unique_ptr< MultiFileList > Copy () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Protected Member Functions

bool ExpandNextPath () const override
 Grabs the next path and expands it into Expanded paths: returns false if no more files to expand.
Protected Member Functions inherited from duckdb::LazyMultiFileList
bool FileIsAvailable (idx_t i) const override
 Whether or not the file at the index is available instantly - or if this requires additional I/O.
OpenFileInfo GetFile (idx_t i) const override
 Get the i-th expanded file.

Protected Attributes

ClientContext & context
 The ClientContext for globbing.
const vector< string > globs
 The list of globs to expand.
const FileGlobInput glob_input
 Glob input.
idx_t current_glob
 The current glob to expand.
vector< unique_ptr< MultiFileList > > file_lists
 File lists for the underlying globs.
MultiFileListScanData scan_state
 Current scan state.
Protected Attributes inherited from duckdb::LazyMultiFileList
mutex lock
vector< OpenFileInfo > expanded_files
 The expanded files.
bool all_files_expanded = false
 Whether or not all files have been expanded.
optional_ptr< ClientContext > context

Detailed Description

MultiFileList that takes a list of globs and resolves all of the globs lazily into files.

Constructor & Destructor Documentation

◆ GlobMultiFileList()

duckdb::GlobMultiFileList::GlobMultiFileList ( ClientContext & context,
vector< string > globs,
FileGlobInput input )
84069 : LazyMultiFileList(&context_p), context(context_p), globs(std::move(globs_p)), glob_input(std::move(glob_input_p)),
84070 current_glob(0) {
84071}
const FileGlobInput glob_input
Glob input.
Definition duckdb.cpp:53877
ClientContext & context
The ClientContext for globbing.
Definition duckdb.cpp:53873
const vector< string > globs
The list of globs to expand.
Definition duckdb.cpp:53875
idx_t current_glob
The current glob to expand.
Definition duckdb.cpp:53879

Member Function Documentation

◆ GetDisplayFileList()

vector< OpenFileInfo > duckdb::GlobMultiFileList::GetDisplayFileList ( optional_idx max_files = optional_idx()) const
overridevirtual

Reimplemented from duckdb::MultiFileList.

84073 {
84074 // for globs we display the actual globs in the ToString() - instead of expanding to the files read
84075 vector<OpenFileInfo> result;
84076 for (auto &glob : globs) {
84077 if (max_files.IsValid() && result.size() >= max_files.GetIndex()) {
84078 break;
84079 }
84080 result.emplace_back(glob);
84081 }
84082 return result;
84083}

◆ ExpandNextPath()

bool duckdb::GlobMultiFileList::ExpandNextPath ( ) const
overrideprotectedvirtual

Grabs the next path and expands it into Expanded paths: returns false if no more files to expand.

Implements duckdb::LazyMultiFileList.

84085 {
84086 if (current_glob >= globs.size()) {
84087 return false;
84088 }
84089 if (current_glob >= file_lists.size()) {
84090 // glob is not yet started for this file - start it and initiate the scan over this file
84091 auto &fs = FileSystem::GetFileSystem(context);
84092 auto glob_result = fs.GlobFileList(globs[current_glob], glob_input);
84093 scan_state = MultiFileListScanData();
84094 glob_result->InitializeScan(scan_state);
84095 file_lists.push_back(std::move(glob_result));
84096 }
84097 // get the next batch of files we can fetch through the glob
84098 auto &glob_list = *file_lists[current_glob];
84099 scan_state.scan_type = MultiFileListScanType::ALWAYS_FETCH;
84100 OpenFileInfo file;
84101 if (!glob_list.Scan(scan_state, file)) {
84102 // no more files available in this glob - move to the next glob
84103 current_glob++;
84104 return true;
84105 }
84106 // we found a file as part of this glob - add it to the result
84107 vector<OpenFileInfo> glob_files;
84108 glob_files.push_back(std::move(file));
84109
84110 // now continue scanning files that are already available (i.e. that don't require extra I/O operations to fetch)
84111 scan_state.scan_type = MultiFileListScanType::FETCH_IF_AVAILABLE;
84112 while (glob_list.Scan(scan_state, file)) {
84113 glob_files.push_back(std::move(file));
84114 }
84115
84116 // sort the files and add them to the list of files
84117 std::sort(glob_files.begin(), glob_files.end());
84118 expanded_files.insert(expanded_files.end(), glob_files.begin(), glob_files.end());
84119
84120 return true;
84121}
MultiFileListScanData scan_state
Current scan state.
Definition duckdb.cpp:53883
vector< unique_ptr< MultiFileList > > file_lists
File lists for the underlying globs.
Definition duckdb.cpp:53881
vector< OpenFileInfo > expanded_files
The expanded files.
Definition duckdb.cpp:53855

The documentation for this class was generated from the following file: