## Features ### PG Wire: run `cargo run --features="net"` to start service ### ORM Mapping: `features = ["macros"]` ```rust #[derive(Default, Debug, PartialEq)] struct MyStruct { c1: i32, c2: String, } implement_from_tuple!( MyStruct, ( c1: i32 => |inner: &mut MyStruct, value| { if let DataValue::Int32(val) = value { inner.c1 = val; } }, c2: String => |inner: &mut MyStruct, value| { if let DataValue::Utf8 { value, .. } = value { inner.c2 = value; } } ) ); ``` ### User-Defined Function: `features = ["macros"]` ```rust scala_function!(TestFunction::test(LogicalType::Integer, LogicalType::Integer) -> LogicalType::Integer => |v1: DataValue, v2: DataValue| { let plus_binary_evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Plus)?; let value = plus_binary_evaluator.binary_eval(&v1, &v2); let plus_unary_evaluator = EvaluatorFactory::unary_create(LogicalType::Integer, UnaryOperator::Minus)?; Ok(plus_unary_evaluator.unary_eval(&value)) }); let fnck_sql = DataBaseBuilder::path("./data") .register_scala_function(TestFunction::new()) .build()?; ``` ### User-Defined Table Function: `features = ["macros"]` ```rust table_function!(MyTableFunction::test_numbers(LogicalType::Integer) -> [c1: LogicalType::Integer, c2: LogicalType::Integer] => (|v1: DataValue| { let num = v1.i32().unwrap(); Ok(Box::new((0..num) .into_iter() .map(|i| Ok(Tuple { id: None, values: vec![ DataValue::Int32(Some(i)), DataValue::Int32(Some(i)), ] }))) as Box>>) })); let fnck_sql = DataBaseBuilder::path("./data") .register_table_function(MyTableFunction::new()) .build()?; ``` ### Optimizer - RBO - CBO based on RBO(Physical Selection) ### Executor - Volcano ### MVCC Transaction - Optimistic ### Field options - [not] null - unique - primary key ### Supports index type - PrimaryKey - Unique - Normal - Composite ### Supports multiple primary key types - Tinyint - UTinyint - Smallint - USmallint - Integer - UInteger - Bigint - UBigint - Char - Varchar ### DDL - Begin (Server only) - Commit (Server only) - Rollback (Server only) - Create - [x] Table - [x] Index: Unique\Normal\Composite - [x] View - Drop - [x] Table - [ ] Index - [x] View - Alert - [x] Add Column - [x] Drop Column - [x] Truncate ### DQL - [x] Select - SeqScan - IndexScan - FunctionScan - [x] Where - [x] Distinct - [x] Alias - [x] Aggregation: - count() - sum() - avg() - min() - max() - [x] SubQuery[select/from/where] - [x] Join: - Inner - Left - Right - Full - Cross (Natural\Using) - [x] Group By - [x] Having - [x] Order By - [x] Limit - [x] Show Tables - [x] Explain - [x] Describe - [x] Union ### DML - [x] Insert - [x] Insert Overwrite - [x] Update - [x] Delete - [x] Analyze - [x] Copy To - [x] Copy From ### DataTypes - Invalid - SqlNull - Boolean - Tinyint - UTinyint - Smallint - USmallint - Integer - UInteger - Bigint - UBigint - Float - Double - Char - Varchar - Date - DateTime - Time - Tuple