Skip to content

Commit

Permalink
Update REAMDE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
lewiszlw committed Feb 2, 2024
1 parent 241f835 commit 054ab50
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 94 deletions.
97 changes: 10 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,11 @@
# bustubx - a relational database for educational purpose (CMU 15-445)
- DDL
- [x] Create
- [x] Create Table
- [x] Create Index
- [ ] Drop
- [ ] Alter
- [ ] Truncate
- DQL
- [x] Select
- [x] Where
- [ ] Distinct
- [ ] Aggregation: Count / Sum / Avg / Min / Max
- [ ] Subquery
- [ ] Join: Left Outer / Right Outer / Full Outer / Inner / Cross
- [ ] Group By
- [ ] Having
- [x] Order By
- [x] Limit
- DML
- [x] Insert
- [ ] Update
- [ ] Delete
- Data Types
- [x] Bool
- [x] TinyInt
- [x] SmallInt
- [x] Integer
- [x] BigInt
- [ ] Float
- [ ] Varchar
- [ ] Null
- Optimizer rules
- [x] Limit Project Transpose
- [x] Eliminate Limits
- [x] Push Limit Through Join
- [ ] Push Limit Into Scan
- [ ] Combine Filters
- [ ] Column Pruning
- [ ] Collapse Project
- Executors
- [x] Create Table
- [x] Create Index
- [x] Table Scan
- [ ] Index Scan
- [x] Filter
- [x] Project
- [x] Limit
- [x] Nested Loop Join
- [ ] Hash Join
- [x] Sort
- [x] Insert
- [x] Values
- [ ] Update
- [ ] Delete
- Transaction
- [ ] Begin
- [ ] Commit
- [ ] Rollback
- [ ] Isolation Level
- [ ] Read Uncommitted
- [ ] Read Committed
- [ ] Repeatable Read
- [ ] Serializable
- Recovery
- [ ] Redo
- [ ] Undo
- [ ] Checkpoint
# BustubX - a relational database for educational purpose (CMU 15-445)
- [ ] DML
- [ ] DDL
- [ ] Rule-based Optimizer
- [ ] Parallel Execution
- [ ] B+ Tree Index
- [ ] Multi-Version Concurrency Control
- [ ] Crash Recovery

## Architecture
![architecture](./docs/bustubx-architecture.png)
Expand All @@ -74,19 +14,7 @@
## Get started
Install rust toolchain first.
```
cargo run
```
test command
```mysql
create table t1(a int, b int);

insert into t1 values(1,1),(2,3),(5,4);

select * from t1;

select * from t1 where a <= b;

select a from t1 where a <= b;
cargo run --bin bustubx-cli
```

![demo](./docs/bustubx-demo.png)
Expand All @@ -99,9 +27,4 @@ select a from t1 where a <= b;
- [talent-plan/tinysql](https://github.com/talent-plan/tinysql)
- [CMU 15-445课程笔记-zhenghe](https://zhenghe.gitbook.io/open-courses/cmu-15-445-645-database-systems/relational-data-model)
- [CMU15-445 22Fall通关记录 - 知乎](https://www.zhihu.com/column/c_1605901992903004160)
- [B+ Tree Visualization](https://www.cs.usfca.edu/~galles/visualization/BPlusTree.html)

## Questions
**1.What if same keys in B+ tree node?**

**2.What if key size exceeds b+ tree index page capacity?**
- [B+ Tree Visualization](https://www.cs.usfca.edu/~galles/visualization/BPlusTree.html)
3 changes: 2 additions & 1 deletion bustubx/src/execution/physical_plan/filter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::Arc;
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::expression::{Expr, ExprTrait};
Expand All @@ -19,7 +20,7 @@ pub struct PhysicalFilter {

impl VolcanoExecutor for PhysicalFilter {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init filter executor");
debug!("init filter executor");
self.input.init(context)
}

Expand Down
4 changes: 2 additions & 2 deletions bustubx/src/execution/physical_plan/limit.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::{atomic::AtomicU32, Arc};
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::{
catalog::Schema,
execution::{ExecutionContext, VolcanoExecutor},
storage::Tuple,
BustubxResult,
Expand Down Expand Up @@ -30,7 +30,7 @@ impl PhysicalLimit {
}
impl VolcanoExecutor for PhysicalLimit {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init limit executor");
debug!("init limit executor");
self.cursor.store(0, std::sync::atomic::Ordering::SeqCst);
self.input.init(context)
}
Expand Down
3 changes: 2 additions & 1 deletion bustubx/src/execution/physical_plan/nested_loop_join.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::{Arc, Mutex};
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::expression::{Expr, ExprTrait};
Expand Down Expand Up @@ -43,7 +44,7 @@ impl PhysicalNestedLoopJoin {
}
impl VolcanoExecutor for PhysicalNestedLoopJoin {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init nested loop join executor");
debug!("init nested loop join executor");
*self.left_tuple.lock().unwrap() = None;
self.left_input.init(context)?;
self.right_input.init(context)
Expand Down
3 changes: 2 additions & 1 deletion bustubx/src/execution/physical_plan/project.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::Arc;
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::expression::{Expr, ExprTrait};
Expand All @@ -19,7 +20,7 @@ pub struct PhysicalProject {

impl VolcanoExecutor for PhysicalProject {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init project executor");
debug!("init project executor");
self.input.init(context)
}

Expand Down
3 changes: 2 additions & 1 deletion bustubx/src/execution/physical_plan/seq_scan.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::Mutex;
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::common::TableReference;
Expand Down Expand Up @@ -28,7 +29,7 @@ impl PhysicalSeqScan {

impl VolcanoExecutor for PhysicalSeqScan {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init table scan executor");
debug!("init table scan executor");
let table_info = context
.catalog
.get_mut_table_by_name(self.table.table())
Expand Down
3 changes: 2 additions & 1 deletion bustubx/src/execution/physical_plan/sort.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::{atomic::AtomicU32, Arc, Mutex};
use tracing::debug;

use crate::catalog::SchemaRef;
use crate::expression::ExprTrait;
Expand Down Expand Up @@ -31,7 +32,7 @@ impl PhysicalSort {
}
impl VolcanoExecutor for PhysicalSort {
fn init(&self, context: &mut ExecutionContext) -> BustubxResult<()> {
println!("init sort executor");
debug!("init sort executor");
self.input.init(context)?;
// TODO move to next method
// load all tuples from input
Expand Down
Binary file modified docs/bustubx-demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 054ab50

Please sign in to comment.