This is our implementation for the course project of CSC3170, 2022 Fall, CUHK(SZ). For details of the project, you can refer to project-description.md. In this project, we will utilize what we learned in the lectures and tutorials in the course, and implement either one of the following major jobs:
- Application with Database System(s)
- Implementation of a Database System
Our team consists of the following members, listed in the table below (the team leader is shown in the first row, and is marked with 🚩 behind his/her name):
Student ID | Student Name | GitHub Account (in Email) | GitHub UserName |
---|---|---|---|
119020401 | 王嘉茗 🚩 | 119020401@link.cuhk.edu.cn | @Jiuma141 |
121090003 | 包景致 | zqlwmatt@gmail.com | @ZqlwMatt |
120040061 | 汪宁远 | 120040061@link.cuhk.edu.cn | @0x727AA7D |
120090108 | 周炜 | 120090108@link.cuhk.edu.cn | @WilhelmZhou |
120090792 | 黄子蒙 | 2207070095@qq.com | @Master-Pyda |
120090784 | 尹启骅 | 120090784@link.cuhk.edu.cn | @edward-coding |
119010306 | 王睿奕 | 119010306@link.cuhk.edu.cn | @wry1205 |
After thorough discussion, our team made the choice and the specification information is listed below:
- Our option choice is: Option 3
- Our branch choice is: Not applied
- The difficulty level is: Not applied
This project involves writing a miniature relational database management system (DBMS) that stores tables of data, where a table consists of some number of labeled columns of information. Our system will include a very simple query language for extracting information from these tables. For the purposes of this project, we will deal only with very small databases, and therefore will not consider speed and efficiency at all.
Full description: https://inst.eecs.berkeley.edu/~cs61b/fa14/hw/proj1.pdf
Our project mainly focuses on the Command Interpreter
module and database structures of database system. It will basically support these functions:
- Interprete SQL language.
- Support the basic structures of database system (e.g. database files, tables, rows, columns).
- Do fundamental queries on database system, including
select
,from
,where
,insert into
,create table
clauses.
Project codes: https://github.com/CSC3170-2022Fall/project-diana-candy-superteam/tree/db61b
The class that handles table instances. Specifically, the database class supports operations to store, retrieve, and delete tables. We utilize two ArrayList to store table instances and table names.
We consider Column
to be an important attribute in the Table,and it is only constructed when the database loads .db
files or executes create
clause (for convenience, we call these tables database tables
, which are stored directory in heap). namely, the Column
is constructed at the same time as the initial table
.
Idea: the columns of a new table obtained by the
select clause
is a subset of thedatabase tables
. (We define atemporary table
is a table created by aselect clause
, otherwisestandard table
. More specifically, the temporary table is one without explicit name)
To maintain this property, the Table should support two ways of construction:
- Table(String[] columnTitles), used for
standard table
. (The columns are initialized by string array) - Table(List columns), used for
temporary table
. (The table borrows columns from the table in database)
By emphasizing the importance of Column
, the role of _columnTitles
(type: String[]) is diminished. We'll just use them as column titles to display to the user.
To reinforce the importance of the column, the Column
class needs to record:
- it belongs to which table,
- its name,
- the full name (
tableName_columnName
)
With item 3, we can solve the problem of attribute name dupilication.
To supprt condition filering, we need to know where the rows in the table after cartesian product come from which table in
from clause
. We define asuper column
having the attribute ofoffset
, which records the offset in the ultimate columns after cartesian product. Specifically, theoffset
attribute is derived when we do table join (cartesian product).
We just fill out the framework provided by this project.
The simpliest unit records all data in String type. We just fill out the framework provided by this project.
In addition to the features mentioned in the design idea, we also made optimization in these aspects:
Table.toString
: print table with adaptive adjustment.Table.select(List<String> columnNames, List<Condition> conditions)
: supports column names and conditions filtering, and we increase the robustness of the function.Column(String name, Table... tables)
: If the length of tables = 1, we are constructing a database table. Otherwise, we are constructing a super column. (robustness)Colume._offset
: use offset in super columns to derive the data after cartesian product.
https://magic-chair-572.notion.site/CSC3170-Project-Pamphlet-c0cbaadee8814760a55b3a1eef0328b3
- Lab 1: Buffer Pool Manager
- Lab 2: Hash Index
- Lab 3: Query Execution
- Lab 4: Concurrency Control
- Lock Manager
- Deadlock Prevention
- Concurrent Query Execution (has dependency on Lab 3)
Project codes: https://github.com/CSC3170-2022Fall/project-diana-candy-superteam/tree/cmu15445