Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/systemxlabs/bustubx
Browse files Browse the repository at this point in the history
  • Loading branch information
lewiszlw committed Jan 28, 2024
2 parents d8705bd + 755d5e7 commit ef0bab4
Show file tree
Hide file tree
Showing 92 changed files with 74 additions and 61 deletions.
31 changes: 21 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 6 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
[package]
name = "bustubx"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
doctest = false

[dependencies]
sqlparser = "0.34.0"
petgraph = "0.6.3"
lazy_static = "1.4.0"
itertools = "0.11.0"
comfy-table = "7.0.1"
derive-new = "0.5.9"
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-chrome = "0.7.1"
thiserror = "1.0.56"

[workspace]
members = ["tests/sqllogictest"]
members = [
"bustubx",
"bustubx-cli",
"tests/sqllogictest",
]
resolver = "2"
12 changes: 12 additions & 0 deletions bustubx-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "bustubx-cli"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bustubx = { path = "../bustubx" }
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-chrome = "0.7.1"
30 changes: 8 additions & 22 deletions src/main.rs → bustubx-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
use std::io::{self, Write};

use tracing::{debug, info, Level};
use bustubx::database::Database;
use std::io::Write;
use tracing::info;
use tracing_chrome::ChromeLayerBuilder;
use tracing_subscriber::{
fmt, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
};

use crate::database::Database;

mod buffer;
mod catalog;
mod common;
mod database;
mod error;
mod execution;
mod expression;
mod optimizer;
mod parser;
mod planner;
mod storage;
use tracing_subscriber::fmt;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;

fn main() {
println!(":) Welcome to the bustubx, please input sql.");
Expand All @@ -39,9 +25,9 @@ fn main() {
info!("database created");
loop {
print!(">");
io::stdout().flush().unwrap();
std::io::stdout().flush().unwrap();
let mut input = String::new();
match io::stdin().read_line(&mut input) {
match std::io::stdin().read_line(&mut input) {
Ok(_) => {
if input.trim() == "exit" {
break;
Expand Down
20 changes: 20 additions & 0 deletions bustubx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "bustubx"
version = "0.1.0"
edition = "2021"

[lib]
doctest = false

[dependencies]
sqlparser = "0.34.0"
petgraph = "0.6.3"
lazy_static = "1.4.0"
itertools = "0.11.0"
comfy-table = "7.0.1"
derive-new = "0.5.9"
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-chrome = "0.7.1"
thiserror = "1.0.56"
tempfile = "3"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib.rs → bustubx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod buffer;
mod catalog;
mod common;
pub mod database;
mod error;
pub mod error;
mod execution;
mod expression;
mod optimizer;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/sqllogictest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "sqllogictest"
name = "bustubx-sqllogictest"
version = "0.1.0"
edition = "2021"

Expand All @@ -8,5 +8,5 @@ edition = "2021"
[dependencies]
sqllogictest = "0.13.0"
tempfile = "3"
bustubx = { path = "../.."}
bustubx = { path = "../../bustubx" }
async-trait = "0.1.77"
7 changes: 4 additions & 3 deletions tests/sqllogictest/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use bustubx::database::Database;
use sqllogictest::DBOutput;
use bustubx::error::BustubxError;
use sqllogictest::{DBOutput, DefaultColumnType};
use tempfile::TempDir;

pub struct Bustubx {
Expand All @@ -17,8 +18,8 @@ impl Bustubx {

#[async_trait::async_trait]
impl sqllogictest::AsyncDB for &Bustubx {
type Error = ();
type ColumnType = ();
type Error = BustubxError;
type ColumnType = DefaultColumnType;

async fn run(&mut self, sql: &str) -> Result<DBOutput<Self::ColumnType>, Self::Error> {
todo!()
Expand Down

0 comments on commit ef0bab4

Please sign in to comment.