Skip to content

Commit

Permalink
chore: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Jan 16, 2025
1 parent 85cf196 commit fac2f19
Show file tree
Hide file tree
Showing 80 changed files with 252 additions and 269 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Cargo.lock
/hello_world
/transaction

fncksql_data
fncksql_bench
kitesql_data
kitesql_bench
sqlite_bench
fnck_sql_tpcc
kite_sql_tpcc
copy.csv

tests/data/row_20000.csv
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[package]
name = "fnck_sql"
version = "0.0.10"
name = "kite_sql"
version = "0.1.0"
edition = "2021"
authors = ["Kould <[email protected]>", "Xwg <[email protected]>"]
description = "SQL as a Function for Rust"
documentation = "https://docs.rs/fnck_sql/latest/fnck_sql/"
documentation = "https://docs.rs/kite_sql/latest/kite_sql/"
license = "Apache-2.0"
repository = "https://github.com/KipData/KipSQL"
readme = "README.md"
keywords = ["sql", "sqlite", "database", "mysql"]
categories = ["development-tools", "database"]
default-run = "fnck_sql"
default-run = "kite_sql"

[[bin]]
name = "fnck_sql"
name = "kite_sql"
path = "src/bin/server.rs"
required-features = ["net"]

Expand Down Expand Up @@ -51,7 +51,7 @@ regex = { version = "1" }
rocksdb = { version = "0.22" }
rust_decimal = { version = "1" }
serde = { version = "1", features = ["derive", "rc"] }
fnck_sql_serde_macros = { version = "0.1.0", path = "fnck_sql_serde_macros" }
kite_sql_serde_macros = { version = "0.1.0", path = "kite_sql_serde_macros" }
siphasher = { version = "1", features = ["serde"] }
sqlparser = { version = "0.34", features = ["serde"] }
thiserror = { version = "1" }
Expand Down Expand Up @@ -82,7 +82,7 @@ pprof = { version = "0.13", features = ["flamegraph", "criterion"] }
members = [
"tests/sqllogictest",
"tests/macros-test",
"fnck_sql_serde_macros",
"kite_sql_serde_macros",
"tpcc"]

[profile.release]
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib n
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y postgresql-client

ARG APP_SERVER=fnck_sql
ARG APP_SERVER=kite_sql

WORKDIR /fnck_sql
WORKDIR /kite_sql

EXPOSE 5432

COPY --from=builder /builder/target/release/${APP_SERVER} ${APP_SERVER}

ENTRYPOINT ["./fnck_sql", "--ip", "0.0.0.0"]
ENTRYPOINT ["./kite_sql", "--ip", "0.0.0.0"]
52 changes: 23 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
<pre align="center">
Built by @KipData


███████╗███╗ ██╗ ██████╗██╗ ██╗ ███████╗ ██████╗ ██╗
██╔════╝████╗ ██║██╔════╝██║ ██╔╝ ██╔════╝██╔═══██╗██║
█████╗ ██╔██╗ ██║██║ █████╔╝ ███████╗██║ ██║██║
██╔══╝ ██║╚██╗██║██║ ██╔═██╗ ╚════██║██║▄▄ ██║██║
██║ ██║ ╚████║╚██████╗██║ ██╗ ███████║╚██████╔╝███████╗
╚═╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚══════╝ ╚══▀▀═╝ ╚══════╝
<p align="center">
<picture>
<source srcset="./static/images/kite_sql_dark.png" media="(prefers-color-scheme: dark)">
<source srcset="./static/images/kite_sql_light.png" media="(prefers-color-scheme: light)">
<img src="./static/images/kite_sql_light.png" alt="KiteSQL Logo" width="400px">
</picture>
</p>

-----------------------------------
🖕
</pre>
<h3 align="center">
SQL as a Function for Rust
</h3>

<p align="center">
<a href="https://summer-ospp.ac.cn/org/orgdetail/0b09d23d-2510-4537-aa9d-45158bb6bdc2"><img src="https://img.shields.io/badge/OSPP-KipData-3DA639?logo=opensourceinitiative"></a>
<a href="https://github.com/KipData/FnckSQL/blob/main/LICENSE"><img src="https://img.shields.io/github/license/KipData/FnckSQL"></a>
<a href="https://github.com/KipData/KiteSQL/blob/main/LICENSE"><img src="https://img.shields.io/github/license/KipData/KiteSQL"></a>
&nbsp;
<a href="https://www.rust-lang.org/community"><img src="https://img.shields.io/badge/Rust_Community%20-Join_us-brightgreen?style=plastic&logo=rust"></a>
</p>
<p align="center">
<a href="https://github.com/KipData/FnckSQL/actions/workflows/ci.yml"><img src="https://github.com/KipData/FnckSQL/actions/workflows/ci.yml/badge.svg" alt="CI"></img></a>
<a href="https://crates.io/crates/fnck_sql/"><img src="https://img.shields.io/crates/v/fnck_sql.svg"></a>
<a href="https://github.com/KipData/FnckSQL" target="_blank">
<img src="https://img.shields.io/github/stars/KipData/FnckSQL.svg?style=social" alt="github star"/>
<img src="https://img.shields.io/github/forks/KipData/FnckSQL.svg?style=social" alt="github fork"/>
<a href="https://github.com/KipData/KiteSQL/actions/workflows/ci.yml"><img src="https://github.com/KipData/KiteSQL/actions/workflows/ci.yml/badge.svg" alt="CI"></img></a>
<a href="https://crates.io/crates/kite_sql/"><img src="https://img.shields.io/crates/v/kite_sql.svg"></a>
<a href="https://github.com/KipData/KiteSQL" target="_blank">
<img src="https://img.shields.io/github/stars/KipData/KiteSQL.svg?style=social" alt="github star"/>
<img src="https://img.shields.io/github/forks/KipData/KiteSQL.svg?style=social" alt="github fork"/>
</a>
</p>

## Introduction
**FnckSQL** is a lightweight embedded database inspired by **MyRocks** and **SQLite** and completely coded in Rust. It aims to provide a more user-friendly, lightweight, and low-loss RDBMS for Rust programming so that the APP does not rely on other complex components. can perform complex relational data operations
**KiteSQL** is a lightweight embedded database inspired by **MyRocks** and **SQLite** and completely coded in Rust. It aims to provide a more user-friendly, lightweight, and low-loss RDBMS for Rust programming so that the APP does not rely on other complex components. can perform complex relational data operations

## Key Features
- A lightweight embedded SQL database fully rewritten in Rust
Expand All @@ -46,16 +40,16 @@ Built by @KipData
## Examples

```rust
let fnck_sql = DataBaseBuilder::path("./data").build()?;
let kite_sql = DataBaseBuilder::path("./data").build()?;

fnck_sql
kite_sql
.run("create table if not exists t1 (c1 int primary key, c2 int)")?
.done()?;
fnck_sql
kite_sql
.run("insert into t1 values(0, 0), (1, 1)")?
.done()?;

for tuple in fnck_sql.run("select * from t1")? {
for tuple in kite_sql.run("select * from t1")? {
println!("{:?}", tuple?);
}
```
Expand Down Expand Up @@ -84,15 +78,15 @@ Order-Status : 0.053 (0.175)
#### 👉[check more](tpcc/README.md)

## Roadmap
- Get [SQL 2016](https://github.com/KipData/FnckSQL/issues/130) mostly supported
- LLVM JIT: [Perf: TPCC](https://github.com/KipData/FnckSQL/issues/247)
- Get [SQL 2016](https://github.com/KipData/KiteSQL/issues/130) mostly supported
- LLVM JIT: [Perf: TPCC](https://github.com/KipData/KiteSQL/issues/247)

## License

FnckSQL uses the [Apache 2.0 license][1] to strike a balance between
KiteSQL uses the [Apache 2.0 license][1] to strike a balance between
open contributions and allowing you to use the software however you want.

[1]: <https://github.com/KipData/FnckSQL/blob/main/LICENSE>
[1]: <https://github.com/KipData/KiteSQL/blob/main/LICENSE>

## Contributors
[![](https://opencollective.com/fncksql/contributors.svg?width=890&button=false)](https://github.com/KipData/FnckSQL/graphs/contributors)
[![](https://opencollective.com/kitesql/contributors.svg?width=890&button=false)](https://github.com/KipData/KiteSQL/graphs/contributors)
20 changes: 10 additions & 10 deletions benchmarks/query_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use criterion::{criterion_group, criterion_main, Criterion};
use fnck_sql::db::{DataBaseBuilder, ResultIter};
use fnck_sql::errors::DatabaseError;
use indicatif::{ProgressBar, ProgressStyle};
use itertools::Itertools;
use kite_sql::db::{DataBaseBuilder, ResultIter};
use kite_sql::errors::DatabaseError;
#[cfg(unix)]
use pprof::criterion::{Output, PProfProfiler};
use sqlite::Error;
use std::fs;
use std::path::Path;

const QUERY_BENCH_FNCK_SQL_PATH: &'static str = "./fncksql_bench";
const QUERY_BENCH_kite_sql_PATH: &'static str = "./kitesql_bench";
const QUERY_BENCH_SQLITE_PATH: &'static str = "./sqlite_bench";
const TABLE_ROW_NUM: u64 = 200_000;

Expand All @@ -24,8 +24,8 @@ fn query_cases() -> Vec<(&'static str, &'static str)> {
]
}

fn init_fncksql_query_bench() -> Result<(), DatabaseError> {
let database = DataBaseBuilder::path(QUERY_BENCH_FNCK_SQL_PATH).build()?;
fn init_kitesql_query_bench() -> Result<(), DatabaseError> {
let database = DataBaseBuilder::path(QUERY_BENCH_kite_sql_PATH).build()?;
database
.run("create table t1 (c1 int primary key, c2 int)")?
.done()?;
Expand Down Expand Up @@ -84,21 +84,21 @@ fn query_on_execute(c: &mut Criterion) {

init_sqlite_query_bench().unwrap();
}
if !path_exists_and_is_directory(QUERY_BENCH_FNCK_SQL_PATH) {
if !path_exists_and_is_directory(QUERY_BENCH_kite_sql_PATH) {
println!(
"FnckSQL: The table is not initialized and data insertion is started. => {}",
"KiteSQL: The table is not initialized and data insertion is started. => {}",
TABLE_ROW_NUM
);

init_fncksql_query_bench().unwrap();
init_kitesql_query_bench().unwrap();
}
let database = DataBaseBuilder::path(QUERY_BENCH_FNCK_SQL_PATH)
let database = DataBaseBuilder::path(QUERY_BENCH_kite_sql_PATH)
.build()
.unwrap();
println!("Table initialization completed");

for (name, case) in query_cases() {
c.bench_function(format!("FnckSQL: {} by '{}'", name, case).as_str(), |b| {
c.bench_function(format!("KiteSQL: {} by '{}'", name, case).as_str(), |b| {
b.iter(|| {
for tuple in database.run(case).unwrap() {
let _ = tuple.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ scala_function!(TestFunction::test(LogicalType::Integer, LogicalType::Integer) -
Ok(plus_unary_evaluator.unary_eval(&value))
});

let fnck_sql = DataBaseBuilder::path("./data")
let kite_sql = DataBaseBuilder::path("./data")
.register_scala_function(TestFunction::new())
.build()?;
```
Expand All @@ -57,7 +57,7 @@ table_function!(MyTableFunction::test_numbers(LogicalType::Integer) -> [c1: Logi
]
}))) as Box<dyn Iterator<Item = Result<Tuple, DatabaseError>>>)
}));
let fnck_sql = DataBaseBuilder::path("./data")
let kite_sql = DataBaseBuilder::path("./data")
.register_table_function(MyTableFunction::new())
.build()?;
```
Expand Down
8 changes: 4 additions & 4 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use fnck_sql::db::{DataBaseBuilder, ResultIter};
use fnck_sql::errors::DatabaseError;
use fnck_sql::implement_from_tuple;
use fnck_sql::types::value::DataValue;
use kite_sql::db::{DataBaseBuilder, ResultIter};
use kite_sql::errors::DatabaseError;
use kite_sql::implement_from_tuple;
use kite_sql::types::value::DataValue;

#[derive(Default, Debug, PartialEq)]
struct MyStruct {
Expand Down
4 changes: 2 additions & 2 deletions examples/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fnck_sql::db::{DataBaseBuilder, ResultIter};
use fnck_sql::errors::DatabaseError;
use kite_sql::db::{DataBaseBuilder, ResultIter};
use kite_sql::errors::DatabaseError;

fn main() -> Result<(), DatabaseError> {
let database = DataBaseBuilder::path("./transaction").build()?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "fnck_sql_serde_macros"
name = "kite_sql_serde_macros"
version = "0.1.0"
edition = "2021"
description = "SerdeMacros for FnckSQL"
description = "SerdeMacros for KiteSQL"
license = "Apache-2.0"

[dependencies]
Expand Down
File renamed without changes.
53 changes: 21 additions & 32 deletions src/bin/server.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use async_trait::async_trait;
use clap::Parser;
use fnck_sql::db::{DBTransaction, DataBaseBuilder, Database, ResultIter};
use fnck_sql::errors::DatabaseError;
use fnck_sql::storage::rocksdb::RocksStorage;
use fnck_sql::types::tuple::{Schema, SchemaRef, Tuple};
use fnck_sql::types::LogicalType;
use futures::stream;
use kite_sql::db::{DBTransaction, DataBaseBuilder, Database, ResultIter};
use kite_sql::errors::DatabaseError;
use kite_sql::storage::rocksdb::RocksStorage;
use kite_sql::types::tuple::{Schema, SchemaRef, Tuple};
use kite_sql::types::LogicalType;
use log::{error, info, LevelFilter};
use parking_lot::Mutex;
use pgwire::api::auth::noop::NoopStartupHandler;
Expand All @@ -25,35 +25,24 @@ use std::sync::Arc;
use tokio::net::TcpListener;

pub(crate) const BANNER: &str = "
███████╗███╗ ██╗ ██████╗██╗ ██╗ ███████╗ ██████╗ ██╗
██╔════╝████╗ ██║██╔════╝██║ ██╔╝ ██╔════╝██╔═══██╗██║
█████╗ ██╔██╗ ██║██║ █████╔╝ ███████╗██║ ██║██║
██╔══╝ ██║╚██╗██║██║ ██╔═██╗ ╚════██║██║▄▄ ██║██║
██║ ██║ ╚████║╚██████╗██║ ██╗ ███████║╚██████╔╝███████╗
╚═╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚══════╝ ╚══▀▀═╝ ╚══════╝
oooo oooo o8o . .oooooo..o .oooooo. ooooo
`888 .8P' `\"' .o8 d8P' `Y8 d8P' `Y8b `888'
888 d8' oooo .o888oo .ooooo. Y88bo. 888 888 888
88888[ `888 888 d88' `88b `\"Y8888o. 888 888 888
888`88b. 888 888 888ooo888 `\"Y88b 888 888 888
888 `88b. 888 888 . 888 .o oo .d8P `88b d88b 888 o
o888o o888o o888o \"888\" `Y8bod8P' 8\"\"88888P' `Y8bood8P'Ybd' o888ooooood8
";

pub const BLOOM: &str = "
_ ._ _ , _ ._
(_ ' ( ` )_ .__)
( ( ( ) `) ) _)
- --=(;;(----(-----)-----);;)==-- -
(__ (_ (_ . _) _) ,__)
`~~`\\ ' . /`~~`
; ;
/ \\
_____________/_ __ \\_____________
";

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[clap(long, default_value = "127.0.0.1")]
ip: String,
#[clap(long, default_value = "5432")]
port: u16,
#[clap(long, default_value = "./fncksql_data")]
#[clap(long, default_value = "./kitesql_data")]
path: String,
}

Expand All @@ -76,15 +65,15 @@ impl DerefMut for TransactionPtr {
unsafe impl Send for TransactionPtr {}
unsafe impl Sync for TransactionPtr {}

pub struct FnckSQLBackend {
pub struct KiteSQLBackend {
inner: Arc<Database<RocksStorage>>,
}

impl FnckSQLBackend {
pub fn new(path: impl Into<PathBuf> + Send) -> Result<FnckSQLBackend, DatabaseError> {
impl KiteSQLBackend {
pub fn new(path: impl Into<PathBuf> + Send) -> Result<KiteSQLBackend, DatabaseError> {
let database = DataBaseBuilder::path(path).build()?;

Ok(FnckSQLBackend {
Ok(KiteSQLBackend {
inner: Arc::new(database),
})
}
Expand Down Expand Up @@ -350,15 +339,15 @@ async fn main() {

let args = Args::parse();
info!("{} \nVersion: {}\n", BANNER, env!("CARGO_PKG_VERSION"));
info!(":) Welcome to the FnckSQL🖕");
info!(":) Welcome to the KiteSQL🪁");
info!("Listen on port {}", args.port);
info!("Tips🔞: ");
info!("Tips: ");
info!(
"1. all data is in the \'{}\' folder in the directory where the application is run",
args.path
);

let backend = FnckSQLBackend::new(args.path).unwrap();
let backend = KiteSQLBackend::new(args.path).unwrap();
let factory = Arc::new(CustomBackendFactory::new(Arc::new(SessionBackend::new(
backend.inner,
))));
Expand All @@ -371,7 +360,7 @@ async fn main() {
error!("[Listener][Failed To Accept]: {}", err);
}
}
_ = quit() => info!("{BLOOM}")
_ = quit() => info!("Bye!")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/binder/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::planner::operator::copy_to_file::CopyToFileOperator;
use crate::planner::operator::table_scan::TableScanOperator;
use crate::planner::operator::Operator;
use crate::planner::Childrens;
use fnck_sql_serde_macros::ReferenceSerialization;
use kite_sql_serde_macros::ReferenceSerialization;
use serde::{Deserialize, Serialize};
use sqlparser::ast::{CopyOption, CopySource, CopyTarget};

Expand Down
Loading

0 comments on commit fac2f19

Please sign in to comment.