SwatDB
Loading...
Searching...
No Matches
relopsmgr.h
Go to the documentation of this file.
1/*
2 * SwatDB
3 *
4 * @authors: See Contributors.doc for code contributors
5 *
6 * Copyright (c) 2020, 2025 Swarthmore College Computer Science Department
7 * Swarthmore PA, Professors Tia Newhall, Ameet Soni
8 */
9
10#ifndef _SWATDB_RELOPSMGR_H_
11#define _SWATDB_RELOPSMGR_H_
12
13
14
19#include <string>
20#include <vector>
21#include <mutex>
22#include "swatdb_types.h"
23
24class FileManager;
25class Catalog;
26class Schema;
27class File;
28class RelationFile;
29class HeapFile;
30class HeapPage;
31class Page;
32class HeapFileScanner;
33class Record;
34class Data;
35class Key;
36
37extern std::string relopsdir;
38
39// @@@@ SWATDB_ASSIGNMENT: NOTEMSG Do not modify this definition
40
47
48 public:
49
64 Catalog *catalog, const char *result_path);
65
78 HeapFile *project(FileId rel_id, std::vector<FieldId> fields);
79
99 FileId rel_id, std::vector<FieldId> fields,
100 std::vector<Comp> comps, std::vector<void *> values,
101 FileId index_id = INVALID_FILE_ID);
102
103
121 HeapFile *join(JoinType jtype, FileId o_fid, FileId i_fid,
122 std::vector<FieldId> outer_field_ids,
123 std::vector<FieldId> inner_field_ids,
124 std::uint32_t block_size = 0);
125
126
144 HeapFile *join(JoinType jtype, FileId o_fid, FileId i_fid,
145 std::uint32_t num_buckets,
146 std::vector<FieldId> outer_field_ids,
147 std::vector<FieldId> inner_field_ids,
148 std::uint32_t num_threads = 0);
149
167 bool checkFilesEqual(FileId file1_id, FileId file2_id);
168
169
170 private:
171 /*
172 * Pointer to the file manager layer of the DBMS
173 */
174 FileManager *file_mgr;
175
176 /*
177 * Pointer to the buffer manager layer of the DBMS
178 */
179 BufferManager *buf_mgr;
180
181 /*
182 * Pointer to the Catalog of the DBMS
183 */
184 Catalog *catalog;
185
190
194 FileId _createJoinRes(FileId outer_fid, FileId inner_fid,
195 std::vector<FieldId> o_fields, std::vector<FieldId> i_fields);
196
202 std::vector<FieldId> fields);
203
209
210};
211
212#endif
Definition bufmgr.h:121
Definition catalog.h:161
Definition data.h:26
Definition filemgr.h:32
Definition file.h:45
Definition heapfilescanner.h:39
Definition heapfile.h:76
Definition heappage.h:94
Definition key.h:38
Definition page.h:27
Definition record.h:34
Definition relopsmgr.h:46
FileId _createProjectRes(Schema *rel_schema, std::vector< FieldId > fields)
int result_num
Definition relopsmgr.h:189
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.
FileId _createResultFile(Schema *schema)
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 ...
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 ...
HeapFile * project(FileId rel_id, std::vector< FieldId > fields)
Runs the Project operation.
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 exac...
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.
FileId _createJoinRes(FileId outer_fid, FileId inner_fid, std::vector< FieldId > o_fields, std::vector< FieldId > i_fields)
Definition relationfile.h:32
Definition schema.h:37
std::uint32_t FileId
Definition swatdb_types.h:33
const std::uint32_t INVALID_FILE_ID
Definition swatdb_types.h:315
JoinType
Definition swatdb_types.h:211
SelectType
Definition swatdb_types.h:201