Skip to content

AbstractIndex

Marcel Weisgut edited this page Sep 6, 2019 · 1 revision

AbstractIndex-Interface

The AbstractIndex-interface has to be implemented by all indexes. It offers virtual methods for row-retrieval in a chunk given one or more search values and allows to check whether an index was built on a given column or multiple columns. This is useful for more advanced indexes that are built on multiple columns and where the order of the columns matters (i.e. composite indexes). E.g. a scan on multiple columns can thus check whether a given index can be used for that particular scan or not.

Iterator-Concept

For the retrieval of rows, we decided to implement iterators. This allows for a very flexible access to the indexed rows and makes the AbstractIndex independent of specific search iterators - using iterators, an index can easily be used for any arbitrary operator, whether the result is only a single value or a range of values. Also, it prevents unnecessary memory consumption such as having to create a result-vector for every request while the results are already present in the index-structures themselves. Lastly, this allows to use many stl-functions such as std::transform, std::for_each or std::find.

The current indexes all work on vectors internally so that we can simply return an already present const_iterator on a std::vector<ChunkOffset> for each request. However, future indexes might not operate on vectors internally so that a more abstract iterator-implementation on AbstractIndex-level becomes necessary. Offering a standards-compliant abstract iterator is not trivial though, since the postfix-operator cannot be created on an abstract class. Using idioms such as CRTP might be necessary.

Sources

The AbstractIndex header file for Hyrise can be found here.