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

The index is an abstract base class that serves as the basis for indexes. More...

#include <duckdb.hpp>

Inheritance diagram for duckdb::BoundIndex:
Collaboration diagram for duckdb::BoundIndex:

Public Member Functions

 BoundIndex (const string &name, const string &index_type, IndexConstraintType index_constraint_type, const vector< column_t > &column_ids, TableIOManager &table_io_manager, const vector< unique_ptr< Expression > > &unbound_expressions, AttachedDatabase &db)
 
bool IsBound () const override
 Returns true if the index is a bound index, and false otherwise.
 
const string & GetIndexType () const override
 The index type (ART, B+-tree, Skip-List, ...)
 
const string & GetIndexName () const override
 The name of the index.
 
IndexConstraintType GetConstraintType () const override
 The index constraint type.
 
void InitializeLock (IndexLock &state)
 Obtains a lock on the index.
 
virtual ErrorData Append (IndexLock &l, DataChunk &chunk, Vector &row_ids)=0
 Appends data to the locked index.
 
ErrorData Append (DataChunk &chunk, Vector &row_ids)
 Obtains a lock and calls Append while holding that lock.
 
virtual ErrorData Append (IndexLock &l, DataChunk &chunk, Vector &row_ids, IndexAppendInfo &info)
 Appends data to the locked index and verifies constraint violations.
 
ErrorData Append (DataChunk &chunk, Vector &row_ids, IndexAppendInfo &info)
 Obtains a lock and calls Append while holding that lock.
 
virtual void VerifyAppend (DataChunk &chunk, IndexAppendInfo &info, optional_ptr< ConflictManager > manager)
 Verify that data can be appended to the index without a constraint violation.
 
virtual void VerifyConstraint (DataChunk &chunk, IndexAppendInfo &info, ConflictManager &manager)
 Verifies the constraint for a chunk of data.
 
virtual void CommitDrop (IndexLock &index_lock)=0
 Deletes all data from the index. The lock obtained from InitializeLock must be held.
 
void CommitDrop () override
 Deletes all data from the index.
 
virtual idx_t TryDelete (IndexLock &state, DataChunk &entries, Vector &row_identifiers, optional_ptr< SelectionVector > deleted_sel=nullptr, optional_ptr< SelectionVector > non_deleted_sel=nullptr)
 
idx_t TryDelete (DataChunk &entries, Vector &row_identifiers, optional_ptr< SelectionVector > deleted_sel=nullptr, optional_ptr< SelectionVector > non_deleted_sel=nullptr)
 Obtains a lock and calls TryDelete while holding that lock.
 
virtual void Delete (IndexLock &state, DataChunk &entries, Vector &row_identifiers)
 
void Delete (DataChunk &entries, Vector &row_identifiers)
 Obtains a lock and calls Delete while holding that lock.
 
virtual ErrorData Insert (IndexLock &l, DataChunk &chunk, Vector &row_ids)=0
 Insert a chunk.
 
virtual ErrorData Insert (IndexLock &l, DataChunk &chunk, Vector &row_ids, IndexAppendInfo &info)
 Insert a chunk and verifies constraint violations.
 
virtual bool MergeIndexes (IndexLock &state, BoundIndex &other_index)=0
 
bool MergeIndexes (BoundIndex &other_index)
 Obtains a lock and calls MergeIndexes while holding that lock.
 
virtual void Vacuum (IndexLock &l)=0
 
void Vacuum ()
 Obtains a lock and calls Vacuum while holding that lock.
 
virtual bool SupportsDeltaIndexes () const
 Whether or not the index supports the creation of delta indexes.
 
virtual unique_ptr< BoundIndexCreateDeltaIndex (DeltaIndexType delta_index_type) const
 
virtual idx_t GetInMemorySize (IndexLock &state)=0
 Returns the in-memory usage of the index. The lock obtained from InitializeLock must be held.
 
idx_t GetInMemorySize ()
 Returns the in-memory usage of the index.
 
virtual void Verify (IndexLock &l)=0
 Returns the string representation of an index, or only traverses and verifies the index.
 
void Verify ()
 Obtains a lock and calls VerifyAndToString.
 
virtual string ToString (IndexLock &l, bool display_ascii=false)=0
 Returns the string representation of an index.
 
string ToString (bool display_ascii=false)
 Obtains a lock and calls ToString.
 
virtual void VerifyAllocations (IndexLock &l)=0
 Ensures that the node allocation counts match the node counts.
 
void VerifyAllocations ()
 Obtains a lock and calls VerifyAllocations.
 
virtual void VerifyBuffers (IndexLock &l)
 Verify the index buffers.
 
void VerifyBuffers ()
 Obtains a lock and calls VerifyBuffers.
 
bool IndexIsUpdated (const vector< PhysicalIndex > &column_ids) const
 Returns true if the index is affected by updates on the specified column IDs, and false otherwise.
 
virtual IndexStorageInfo SerializeToDisk (QueryContext context, const case_insensitive_map_t< Value > &options)
 Serializes index memory to disk and returns the index storage information.
 
virtual IndexStorageInfo SerializeToWAL (const case_insensitive_map_t< Value > &options)
 Serializes index memory to the WAL and returns the index storage information.
 
void ExecuteExpressions (DataChunk &input, DataChunk &result)
 Execute the index expressions on an input chunk.
 
virtual string GetConstraintViolationMessage (VerifyExistenceType verify_type, idx_t failed_index, DataChunk &input)=0
 Throw a constraint violation exception.
 
void ApplyBufferedReplays (const vector< LogicalType > &table_types, BufferedIndexReplays &buffered_replays, const vector< StorageIndex > &mapped_column_ids)
 
- Public Member Functions inherited from duckdb::Index
bool IsUnique () const
 Returns unique flag.
 
bool IsPrimary () const
 Returns primary key flag.
 
bool IsForeign () const
 Returns foreign key flag.
 
const vector< column_t > & GetColumnIds () const
 
const unordered_set< column_t > & GetColumnIdSet () const
 
template<class TARGET >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () const
 

Static Public Member Functions

static string AppendRowError (DataChunk &input, idx_t index)
 

Public Attributes

vector< PhysicalTypetypes
 The physical types stored in the index.
 
vector< LogicalTypelogical_types
 The logical types of the expressions.
 
string name
 The name of the index.
 
string index_type
 The index type (ART, B+-tree, Skip-List, ...)
 
IndexConstraintType index_constraint_type
 The index constraint type.
 
vector< unique_ptr< Expression > > unbound_expressions
 
DeltaIndexType delta_index_type = DeltaIndexType::NONE
 Whether or not this is a delta index - and if it is, which type it is.
 
- Public Attributes inherited from duckdb::Index
TableIOManagertable_io_manager
 Associated table io manager.
 
AttachedDatabasedb
 Attached database instance.
 

Protected Attributes

mutex lock
 Lock used for any changes to the index.
 
vector< unique_ptr< Expression > > bound_expressions
 
- Protected Attributes inherited from duckdb::Index
vector< column_tcolumn_ids
 
unordered_set< column_tcolumn_id_set
 Unordered set of column_ids used by the Index.
 

Private Member Functions

unique_ptr< ExpressionBindExpression (unique_ptr< Expression > expr)
 Bind the unbound expressions of the index.
 

Private Attributes

ExpressionExecutor executor
 Expression executor to execute the index expressions.
 

Additional Inherited Members

- Protected Member Functions inherited from duckdb::Index
 Index (const vector< column_t > &column_ids, TableIOManager &table_io_manager, AttachedDatabase &db)
 

Detailed Description

The index is an abstract base class that serves as the basis for indexes.

Member Function Documentation

◆ IsBound()

bool duckdb::BoundIndex::IsBound ( ) const
inlineoverridevirtual

Returns true if the index is a bound index, and false otherwise.

Implements duckdb::Index.

50047 {
50048 return true;
50049 }

◆ GetIndexType()

const string & duckdb::BoundIndex::GetIndexType ( ) const
inlineoverridevirtual

The index type (ART, B+-tree, Skip-List, ...)

Implements duckdb::Index.

50050 {
50051 return index_type;
50052 }
string index_type
The index type (ART, B+-tree, Skip-List, ...)
Definition duckdb.hpp:50027

◆ GetIndexName()

const string & duckdb::BoundIndex::GetIndexName ( ) const
inlineoverridevirtual

The name of the index.

Implements duckdb::Index.

50053 {
50054 return name;
50055 }
string name
The name of the index.
Definition duckdb.hpp:50025

◆ GetConstraintType()

IndexConstraintType duckdb::BoundIndex::GetConstraintType ( ) const
inlineoverridevirtual

The index constraint type.

Implements duckdb::Index.

50056 {
50057 return index_constraint_type;
50058 }
IndexConstraintType index_constraint_type
The index constraint type.
Definition duckdb.hpp:50029

◆ Append() [1/2]

virtual ErrorData duckdb::BoundIndex::Append ( IndexLock l,
DataChunk chunk,
Vector row_ids 
)
pure virtual

Appends data to the locked index.

Implemented in duckdb::ART.

◆ Append() [2/2]

virtual ErrorData duckdb::BoundIndex::Append ( IndexLock l,
DataChunk chunk,
Vector row_ids,
IndexAppendInfo info 
)
virtual

Appends data to the locked index and verifies constraint violations.

Reimplemented in duckdb::ART.

◆ VerifyAppend()

virtual void duckdb::BoundIndex::VerifyAppend ( DataChunk chunk,
IndexAppendInfo info,
optional_ptr< ConflictManager manager 
)
virtual

Verify that data can be appended to the index without a constraint violation.

Reimplemented in duckdb::ART.

◆ VerifyConstraint()

virtual void duckdb::BoundIndex::VerifyConstraint ( DataChunk chunk,
IndexAppendInfo info,
ConflictManager manager 
)
virtual

Verifies the constraint for a chunk of data.

Reimplemented in duckdb::ART.

◆ CommitDrop() [1/2]

virtual void duckdb::BoundIndex::CommitDrop ( IndexLock index_lock)
pure virtual

Deletes all data from the index. The lock obtained from InitializeLock must be held.

Implemented in duckdb::ART.

◆ CommitDrop() [2/2]

void duckdb::BoundIndex::CommitDrop ( )
overridevirtual

Deletes all data from the index.

Implements duckdb::Index.

◆ TryDelete()

virtual idx_t duckdb::BoundIndex::TryDelete ( IndexLock state,
DataChunk entries,
Vector row_identifiers,
optional_ptr< SelectionVector deleted_sel = nullptr,
optional_ptr< SelectionVector non_deleted_sel = nullptr 
)
virtual

Delete a chunk of entries from the index. The lock obtained from InitializeLock must be held. Returns the amount of rows successfully deleted from the index. If either deleted_sel or non_deleted_sel are provided the exact rows that were (not) deleted are written there

Reimplemented in duckdb::ART.

◆ Delete()

virtual void duckdb::BoundIndex::Delete ( IndexLock state,
DataChunk entries,
Vector row_identifiers 
)
virtual

Delete a chunk of entries from the index. The lock obtained from InitializeLock must be held. Throws an error if not all rows are deleted

◆ Insert() [1/2]

virtual ErrorData duckdb::BoundIndex::Insert ( IndexLock l,
DataChunk chunk,
Vector row_ids 
)
pure virtual

Insert a chunk.

Implemented in duckdb::ART.

◆ Insert() [2/2]

virtual ErrorData duckdb::BoundIndex::Insert ( IndexLock l,
DataChunk chunk,
Vector row_ids,
IndexAppendInfo info 
)
virtual

Insert a chunk and verifies constraint violations.

Reimplemented in duckdb::ART.

◆ MergeIndexes()

virtual bool duckdb::BoundIndex::MergeIndexes ( IndexLock state,
BoundIndex other_index 
)
pure virtual

Merge another index into this index. The lock obtained from InitializeLock must be held, and the other index must also be locked during the merge

Implemented in duckdb::ART.

◆ Vacuum()

virtual void duckdb::BoundIndex::Vacuum ( IndexLock l)
pure virtual

Performs a full traversal of the ART while vacuuming the qualifying nodes. The lock obtained from InitializeLock must be held.

Implemented in duckdb::ART.

◆ SupportsDeltaIndexes()

virtual bool duckdb::BoundIndex::SupportsDeltaIndexes ( ) const
virtual

Whether or not the index supports the creation of delta indexes.

Reimplemented in duckdb::ART.

◆ CreateDeltaIndex()

virtual unique_ptr< BoundIndex > duckdb::BoundIndex::CreateDeltaIndex ( DeltaIndexType  delta_index_type) const
virtual

Creates a delta index - an empty copy of the index with the same schema, etc This will only be called if SupportsDeltaIndexes returns true

Reimplemented in duckdb::ART.

◆ GetInMemorySize()

virtual idx_t duckdb::BoundIndex::GetInMemorySize ( IndexLock state)
pure virtual

Returns the in-memory usage of the index. The lock obtained from InitializeLock must be held.

Implemented in duckdb::ART.

◆ Verify()

virtual void duckdb::BoundIndex::Verify ( IndexLock l)
pure virtual

Returns the string representation of an index, or only traverses and verifies the index.

Implemented in duckdb::ART.

◆ ToString()

virtual string duckdb::BoundIndex::ToString ( IndexLock l,
bool  display_ascii = false 
)
pure virtual

Returns the string representation of an index.

Implemented in duckdb::ART.

◆ VerifyAllocations()

virtual void duckdb::BoundIndex::VerifyAllocations ( IndexLock l)
pure virtual

Ensures that the node allocation counts match the node counts.

Implemented in duckdb::ART.

◆ VerifyBuffers()

virtual void duckdb::BoundIndex::VerifyBuffers ( IndexLock l)
virtual

Verify the index buffers.

Reimplemented in duckdb::ART.

◆ SerializeToDisk()

virtual IndexStorageInfo duckdb::BoundIndex::SerializeToDisk ( QueryContext  context,
const case_insensitive_map_t< Value > &  options 
)
virtual

Serializes index memory to disk and returns the index storage information.

Reimplemented in duckdb::ART.

◆ SerializeToWAL()

virtual IndexStorageInfo duckdb::BoundIndex::SerializeToWAL ( const case_insensitive_map_t< Value > &  options)
virtual

Serializes index memory to the WAL and returns the index storage information.

Reimplemented in duckdb::ART.

◆ GetConstraintViolationMessage()

virtual string duckdb::BoundIndex::GetConstraintViolationMessage ( VerifyExistenceType  verify_type,
idx_t  failed_index,
DataChunk input 
)
pure virtual

Throw a constraint violation exception.

Implemented in duckdb::ART.

◆ ApplyBufferedReplays()

void duckdb::BoundIndex::ApplyBufferedReplays ( const vector< LogicalType > &  table_types,
BufferedIndexReplays buffered_replays,
const vector< StorageIndex > &  mapped_column_ids 
)

Replay index insert and delete operations buffered during WAL replay. table_types has the physical types of the table in the order they appear, not logical (no generated columns). mapped_column_ids contains the sorted order of Indexed physical column ID's (see unbound_index.hpp comments).

Member Data Documentation

◆ unbound_expressions

vector<unique_ptr<Expression> > duckdb::BoundIndex::unbound_expressions

The vector of unbound expressions, which are later turned into bound expressions. We need to store the unbound expressions, as we might not always have the context available to bind directly. The leaves of these unbound expressions are BoundColumnRefExpressions. These BoundColumnRefExpressions contain a binding (ColumnBinding), and that contains a table_index and a column_index. The table_index is a dummy placeholder. The column_index indexes the column_ids vector in the Index base class. Those column_ids store the physical table indexes of the Index, and we use them when binding the unbound expressions.

◆ bound_expressions

vector<unique_ptr<Expression> > duckdb::BoundIndex::bound_expressions
protected

The vector of bound expressions to generate the Index keys based on a data chunk. The leaves of the bound expressions are BoundReferenceExpressions. These BoundReferenceExpressions contain offsets into the DataChunk to retrieve the columns for the expression. With these offsets into the DataChunk, the expression executor can now evaluate the expression on incoming data chunks to generate the keys.


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