#include <relopsmgr.h>
|
| RelOpsManager (FileManager *file_mgr, BufferManager *buf_mgr, Catalog *catalog, const char *result_path) |
| Creates SwatDB Relops layer, the interface to the relational operations functionality of the DB.
|
|
HeapFile * | project (FileId rel_id, std::vector< FieldId > fields) |
| Runs the Project operation.
|
|
HeapFile * | select (SelectType stype, FileId rel_id, std::vector< FieldId > fields, std::vector< Comp > comps, std::vector< void * > values, FileId index_id=INVALID_FILE_ID) |
| Runs the Select operation using the type of select given by the argument stype.
|
|
HeapFile * | join (JoinType jtype, FileId o_fid, FileId i_fid, std::vector< FieldId > outer_field_ids, std::vector< FieldId > inner_field_ids, std::uint32_t block_size=0) |
| Runs the Join operation using the type of join given by the argument jtype. This overloaded function only runs TupleNLJ and BlockNLJ, the others are implemented in the other overloaded versions.
|
|
HeapFile * | join (JoinType jtype, FileId o_fid, FileId i_fid, std::uint32_t num_buckets, std::vector< FieldId > outer_field_ids, std::vector< FieldId > inner_field_ids, std::uint32_t num_threads=0) |
| Runs the Join operation using the type of join given by the argument jtype. This overloaded function only runs HashJoin and ParallelHashJoin, the others are implemented in the other overloaded versions.
|
|
bool | checkFilesEqual (FileId file1_id, FileId file2_id) |
| Checks if two files have identical contents (every record in file1 also exists in file2 with the exact same value). This is done by running a join on all columns and returning true if the resulting file has the same number of records as the original files. Note: this will only work if neither files have any duplicates.
|
|
SwatDB RelOpsManager Class. The interface to relational operators layer of the system: manages relational operators.
◆ RelOpsManager()
Creates SwatDB Relops layer, the interface to the relational operations functionality of the DB.
- Precondition
- Input parameter objects (file_mgr, buf_mgr, catalog) are initialized and valid.
- Parameters
-
◆ _createJoinRes()
Creates a result file with the schema of the joined relations
◆ _createProjectRes()
Creates a result file with the schema of rel_schema, but only the fields in the fields parameter. Used for the project operation.
◆ _createResultFile()
Creates a result file with the schema given using result_num, then increments result_num
◆ checkFilesEqual()
bool RelOpsManager::checkFilesEqual |
( |
FileId |
file1_id, |
|
|
FileId |
file2_id |
|
) |
| |
Checks if two files have identical contents (every record in file1 also exists in file2 with the exact same value). This is done by running a join on all columns and returning true if the resulting file has the same number of records as the original files. Note: this will only work if neither files have any duplicates.
- Precondition
- Files have the same schema and no duplicate records.
- Parameters
-
file1_id. | FileId of first file to be compared. |
file2_id. | FileId of second file to be compared. |
- Exceptions
-
- Returns
- True if files are identical, False otherwise.
◆ join() [1/2]
HeapFile * RelOpsManager::join |
( |
JoinType |
jtype, |
|
|
FileId |
o_fid, |
|
|
FileId |
i_fid, |
|
|
std::uint32_t |
num_buckets, |
|
|
std::vector< FieldId > |
outer_field_ids, |
|
|
std::vector< FieldId > |
inner_field_ids, |
|
|
std::uint32_t |
num_threads = 0 |
|
) |
| |
Runs the Join operation using the type of join given by the argument jtype. This overloaded function only runs HashJoin and ParallelHashJoin, the others are implemented in the other overloaded versions.
- Precondition
- Input parameters o_fid and i_fid are valid relation ids and fields and values align.
- Parameters
-
jtype. | JoinType indicating type of join (tuplenlj, blocknlj, etc) |
o_fid. | FileId of the outer relation of the join. |
i_fid. | FileId of the inner relation of the join. |
outer_field_ids. | Vector of field ids for the outer relation. |
inner_field_ids. | Vector of field ids for the inner relation. |
num_buckets. | Number of buckets used for hash joins.. |
num_threads. | Number of threads for parallel hash join. |
◆ join() [2/2]
Runs the Join operation using the type of join given by the argument jtype. This overloaded function only runs TupleNLJ and BlockNLJ, the others are implemented in the other overloaded versions.
- Precondition
- Input parameters o_fid and i_fid are valid relation ids and fields and values align.
- Parameters
-
jtype. | JoinType indicating type of join (tuplenlj, blocknlj, etc) |
o_fid. | FileId of the outer relation of the join. |
i_fid. | FileId of the inner relation of the join. |
outer_field_ids. | Vector of field ids for the outer relation. |
inner_field_ids. | Vector of field ids for the inner relation. |
block_size. | Uint32 indicating block size if block nlj is run. This parameter is also used as the inner_index_id if the jtype is indexNLJ. |
◆ project()
Runs the Project operation.
- Precondition
- Input parameters rel_id is a valid relation id to be projected on
- Parameters
-
rel_id. | FileId corresponding to relation fileid being projected on |
fields. | Vector of fieldids corresponding to fields being projected on` |
- Returns
- HeapFile * of the result file with results of the project.
◆ select()
Runs the Select operation using the type of select given by the argument stype.
- Precondition
- Input parameters rel_id is a valid relation id to be selected on, and fields and values have the same types.
- Parameters
-
stype. | SelectType indicating type of select (filescan, index) |
rel_id. | FileId corresponding to relation fileid being selected on |
fields. | Vector of fieldids corresponding to fields being selected on |
comps. | Vector of Comp corresponding to comparators for selection |
values. | Vector of void * corresponding to values for selection |
index_id. | FileId with default value INVALID_FILE_ID corresponding to index file id if indexscan is being used. |
- Returns
- HeapFile * of the result file with results of the select.
◆ result_num
int RelOpsManager::result_num |
|
private |
Stores the current result number
The documentation for this class was generated from the following file: