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::LazyMultiFileList Class Referenceabstract

Lazily expanded MultiFileList. More...

Inheritance diagram for duckdb::LazyMultiFileList:
Collaboration diagram for duckdb::LazyMultiFileList:

Public Member Functions

 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 vector< OpenFileInfo > GetDisplayFileList (optional_idx max_files=optional_idx()) 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 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.
virtual bool ExpandNextPath () const =0
 Grabs the next path and expands it into Expanded paths: returns false if no more files to expand.

Protected Attributes

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

Private Member Functions

bool ExpandNextPathInternal () const

Detailed Description

Lazily expanded MultiFileList.

Constructor & Destructor Documentation

◆ LazyMultiFileList()

duckdb::LazyMultiFileList::LazyMultiFileList ( optional_ptr< ClientContext > context)
explicit
83996 : context(context_p) {
83997}

Member Function Documentation

◆ GetAllFiles()

vector< OpenFileInfo > duckdb::LazyMultiFileList::GetAllFiles ( ) const
overridevirtual

Implements duckdb::MultiFileList.

83999 {
84000 lock_guard<mutex> lck(lock);
84001 while (ExpandNextPathInternal()) {
84002 }
84003 return expanded_files;
84004}
vector< OpenFileInfo > expanded_files
The expanded files.
Definition duckdb.cpp:53855

◆ GetExpandResult()

FileExpandResult duckdb::LazyMultiFileList::GetExpandResult ( ) const
overridevirtual

Implements duckdb::MultiFileList.

84022 {
84023 // GetFile(1) will ensure at least the first 2 files are expanded if they are available
84024 (void)GetFile(1);
84025
84026 lock_guard<mutex> lck(lock);
84027 if (expanded_files.size() > 1) {
84028 return FileExpandResult::MULTIPLE_FILES;
84029 } else if (expanded_files.size() == 1) {
84030 return FileExpandResult::SINGLE_FILE;
84031 }
84032 return FileExpandResult::NO_FILES;
84033}
OpenFileInfo GetFile(idx_t i) const override
Get the i-th expanded file.
Definition duckdb.cpp:84040

◆ GetTotalFileCount()

idx_t duckdb::LazyMultiFileList::GetTotalFileCount ( ) const
overridevirtual

Get the total file count - forces all files to be expanded / known so the exact count can be computed.

Implements duckdb::MultiFileList.

84006 {
84007 lock_guard<mutex> lck(lock);
84008 while (ExpandNextPathInternal()) {
84009 }
84010 return expanded_files.size();
84011}

◆ GetFileCount()

MultiFileCount duckdb::LazyMultiFileList::GetFileCount ( idx_t min_exact_count = 0) const
overridevirtual

Get the file count - anything under "min_exact_count" is allowed to be incomplete (i.e. NOT_ALL_FILES_KNOWN) This allows us to get a rough idea of the file count

Reimplemented from duckdb::MultiFileList.

84013 {
84014 lock_guard<mutex> lck(lock);
84015 // expand files so that we get to min_exact_count
84016 while (!all_files_expanded && expanded_files.size() < min_exact_count && ExpandNextPathInternal()) {
84017 }
84018 auto type = all_files_expanded ? FileExpansionType::ALL_FILES_EXPANDED : FileExpansionType::NOT_ALL_FILES_KNOWN;
84019 return MultiFileCount(expanded_files.size(), type);
84020}
bool all_files_expanded
Whether or not all files have been expanded.
Definition duckdb.cpp:53857

◆ FileIsAvailable()

bool duckdb::LazyMultiFileList::FileIsAvailable ( idx_t i) const
overrideprotectedvirtual

Whether or not the file at the index is available instantly - or if this requires additional I/O.

Reimplemented from duckdb::MultiFileList.

84035 {
84036 lock_guard<mutex> lck(lock);
84037 return i < expanded_files.size();
84038}

◆ GetFile()

OpenFileInfo duckdb::LazyMultiFileList::GetFile ( idx_t i) const
overrideprotectedvirtual

Get the i-th expanded file.

Implements duckdb::MultiFileList.

84040 {
84041 lock_guard<mutex> lck(lock);
84042 while (expanded_files.size() <= i) {
84043 if (!ExpandNextPathInternal()) {
84044 return OpenFileInfo("");
84045 }
84046 }
84047 D_ASSERT(expanded_files.size() > i);
84048 return expanded_files[i];
84049}

◆ ExpandNextPath()

virtual bool duckdb::LazyMultiFileList::ExpandNextPath ( ) const
protectedpure virtual

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

Implemented in duckdb::GlobMultiFileList, and duckdb::LocalGlobResult.

◆ ExpandNextPathInternal()

bool duckdb::LazyMultiFileList::ExpandNextPathInternal ( ) const
private
84051 {
84052 if (all_files_expanded) {
84053 return false;
84054 }
84055 if (context && context->interrupted) {
84056 throw InterruptException();
84057 }
84058 if (!ExpandNextPath()) {
84059 all_files_expanded = true;
84060 return false;
84061 }
84062 return true;
84063}
virtual bool ExpandNextPath() const =0
Grabs the next path and expands it into Expanded paths: returns false if no more files to expand.

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