diff --git a/Cargo.toml b/Cargo.toml index 00d40e95..71c644bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,7 +59,7 @@ regex = { version = "1" } rocksdb = { version = "0.22.0" } rust_decimal = { version = "1" } serde = { version = "1", features = ["derive", "rc"] } -serde_macros = { path = "serde_macros" } +fnck_sql_serde_macros = { version = "0.1.0", path = "fnck_sql_serde_macros" } siphasher = { version = "1", features = ["serde"] } sqlparser = { version = "0.34", features = ["serde"] } strum_macros = { version = "0.26.2" } @@ -85,7 +85,7 @@ pprof = { version = "0.13", features = ["flamegraph", "criterion"] } members = [ "tests/sqllogictest", "tests/macros-test" -, "serde_macros"] +, "fnck_sql_serde_macros"] [profile.release] lto = true diff --git a/fnck_sql_serde_macros/Cargo.toml b/fnck_sql_serde_macros/Cargo.toml new file mode 100644 index 00000000..6945493b --- /dev/null +++ b/fnck_sql_serde_macros/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "fnck_sql_serde_macros" +version = "0.1.0" +edition = "2021" +description = "SerdeMacros for FnckSQL" +license = "Apache-2.0" + +[dependencies] +darling = "0.20" +proc-macro2 = "1" +quote = "1" +syn = "2" + +[lib] +path = "src/lib.rs" +proc-macro = true diff --git a/serde_macros/src/lib.rs b/fnck_sql_serde_macros/src/lib.rs similarity index 100% rename from serde_macros/src/lib.rs rename to fnck_sql_serde_macros/src/lib.rs diff --git a/serde_macros/src/reference_serialization.rs b/fnck_sql_serde_macros/src/reference_serialization.rs similarity index 100% rename from serde_macros/src/reference_serialization.rs rename to fnck_sql_serde_macros/src/reference_serialization.rs diff --git a/serde_macros/Cargo.toml b/serde_macros/Cargo.toml deleted file mode 100644 index f737c53d..00000000 --- a/serde_macros/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "serde_macros" -version = "0.1.0" -edition = "2021" - -[dependencies] -darling = "0.20" -proc-macro2 = "1" -quote = "1" -syn = "2" - -[lib] -path = "src/lib.rs" -proc-macro = true diff --git a/src/binder/copy.rs b/src/binder/copy.rs index 1ea6caf4..89573935 100644 --- a/src/binder/copy.rs +++ b/src/binder/copy.rs @@ -7,8 +7,8 @@ use crate::errors::DatabaseError; use crate::planner::operator::copy_from_file::CopyFromFileOperator; use crate::planner::operator::copy_to_file::CopyToFileOperator; use crate::planner::operator::Operator; +use fnck_sql_serde_macros::ReferenceSerialization; use serde::{Deserialize, Serialize}; -use serde_macros::ReferenceSerialization; use sqlparser::ast::{CopyOption, CopySource, CopyTarget}; #[derive(Debug, PartialEq, PartialOrd, Ord, Hash, Eq, Clone, ReferenceSerialization)] diff --git a/src/catalog/column.rs b/src/catalog/column.rs index 5bf8fced..e7c537ad 100644 --- a/src/catalog/column.rs +++ b/src/catalog/column.rs @@ -4,7 +4,7 @@ use crate::expression::ScalarExpression; use crate::types::tuple::EMPTY_TUPLE; use crate::types::value::ValueRef; use crate::types::{ColumnId, LogicalType}; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use sqlparser::ast::CharLengthUnits; use std::hash::Hash; use std::ops::Deref; diff --git a/src/catalog/table.rs b/src/catalog/table.rs index 23c2601d..49b695fd 100644 --- a/src/catalog/table.rs +++ b/src/catalog/table.rs @@ -3,8 +3,8 @@ use crate::errors::DatabaseError; use crate::types::index::{IndexMeta, IndexMetaRef, IndexType}; use crate::types::tuple::SchemaRef; use crate::types::{ColumnId, LogicalType}; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::collections::BTreeMap; use std::sync::Arc; use std::{slice, vec}; diff --git a/src/catalog/view.rs b/src/catalog/view.rs index b6e42cbb..979e3538 100644 --- a/src/catalog/view.rs +++ b/src/catalog/view.rs @@ -1,6 +1,6 @@ use crate::catalog::TableName; use crate::planner::LogicalPlan; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/expression/agg.rs b/src/expression/agg.rs index 55ea36b8..61f28cbd 100644 --- a/src/expression/agg.rs +++ b/src/expression/agg.rs @@ -1,4 +1,4 @@ -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ReferenceSerialization)] pub enum AggKind { diff --git a/src/expression/function/scala.rs b/src/expression/function/scala.rs index 65095296..60409b69 100644 --- a/src/expression/function/scala.rs +++ b/src/expression/function/scala.rs @@ -5,8 +5,8 @@ use crate::expression::ScalarExpression; use crate::types::tuple::Tuple; use crate::types::value::DataValue; use crate::types::LogicalType; +use fnck_sql_serde_macros::ReferenceSerialization; use serde::{Deserialize, Serialize}; -use serde_macros::ReferenceSerialization; use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::ops::Deref; diff --git a/src/expression/function/table.rs b/src/expression/function/table.rs index c12dfe60..60abf742 100644 --- a/src/expression/function/table.rs +++ b/src/expression/function/table.rs @@ -3,8 +3,8 @@ use crate::errors::DatabaseError; use crate::expression::function::FunctionSummary; use crate::expression::ScalarExpression; use crate::types::tuple::{SchemaRef, Tuple}; +use fnck_sql_serde_macros::ReferenceSerialization; use serde::{Deserialize, Serialize}; -use serde_macros::ReferenceSerialization; use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::ops::Deref; diff --git a/src/expression/mod.rs b/src/expression/mod.rs index 252a38b7..9d6fef70 100644 --- a/src/expression/mod.rs +++ b/src/expression/mod.rs @@ -6,8 +6,8 @@ use crate::expression::function::table::TableFunction; use crate::types::evaluator::{BinaryEvaluatorBox, EvaluatorFactory, UnaryEvaluatorBox}; use crate::types::value::ValueRef; use crate::types::LogicalType; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use sqlparser::ast::TrimWhereField; use sqlparser::ast::{ BinaryOperator as SqlBinaryOperator, CharLengthUnits, UnaryOperator as SqlUnaryOperator, diff --git a/src/expression/range_detacher.rs b/src/expression/range_detacher.rs index 764afdff..c0b9590d 100644 --- a/src/expression/range_detacher.rs +++ b/src/expression/range_detacher.rs @@ -2,8 +2,8 @@ use crate::catalog::ColumnRef; use crate::expression::{BinaryOperator, ScalarExpression}; use crate::types::value::{DataValue, ValueRef, NULL_VALUE}; use crate::types::ColumnId; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::cmp::Ordering; use std::collections::Bound; use std::fmt::Formatter; diff --git a/src/optimizer/core/histogram.rs b/src/optimizer/core/histogram.rs index cd04751b..5d2a08c9 100644 --- a/src/optimizer/core/histogram.rs +++ b/src/optimizer/core/histogram.rs @@ -7,8 +7,8 @@ use crate::types::evaluator::EvaluatorFactory; use crate::types::index::{IndexId, IndexMeta}; use crate::types::value::{DataValue, ValueRef}; use crate::types::LogicalType; +use fnck_sql_serde_macros::ReferenceSerialization; use ordered_float::OrderedFloat; -use serde_macros::ReferenceSerialization; use std::collections::Bound; use std::sync::Arc; use std::{cmp, mem}; diff --git a/src/optimizer/core/statistics_meta.rs b/src/optimizer/core/statistics_meta.rs index 4686a590..76dc4591 100644 --- a/src/optimizer/core/statistics_meta.rs +++ b/src/optimizer/core/statistics_meta.rs @@ -7,7 +7,7 @@ use crate::serdes::{ReferenceSerialization, ReferenceTables}; use crate::storage::{StatisticsMetaCache, Transaction}; use crate::types::index::IndexId; use crate::types::value::DataValue; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fs::OpenOptions; use std::io::Write; use std::path::Path; diff --git a/src/planner/mod.rs b/src/planner/mod.rs index 805f7229..a1087f78 100644 --- a/src/planner/mod.rs +++ b/src/planner/mod.rs @@ -6,8 +6,8 @@ use crate::planner::operator::union::UnionOperator; use crate::planner::operator::values::ValuesOperator; use crate::planner::operator::{Operator, PhysicalOption}; use crate::types::tuple::{Schema, SchemaRef}; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::sync::Arc; #[derive(Debug, Clone)] diff --git a/src/planner/operator/aggregate.rs b/src/planner/operator/aggregate.rs index a3869aac..79d5860e 100644 --- a/src/planner/operator/aggregate.rs +++ b/src/planner/operator/aggregate.rs @@ -1,7 +1,7 @@ use crate::planner::LogicalPlan; use crate::{expression::ScalarExpression, planner::operator::Operator}; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/alter_table/add_column.rs b/src/planner/operator/alter_table/add_column.rs index 9409675b..4b5036df 100644 --- a/src/planner/operator/alter_table/add_column.rs +++ b/src/planner/operator/alter_table/add_column.rs @@ -1,5 +1,5 @@ use crate::catalog::{ColumnCatalog, TableName}; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/alter_table/drop_column.rs b/src/planner/operator/alter_table/drop_column.rs index 2a8ecad9..8d4e5c17 100644 --- a/src/planner/operator/alter_table/drop_column.rs +++ b/src/planner/operator/alter_table/drop_column.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/analyze.rs b/src/planner/operator/analyze.rs index c4475fa4..0020141b 100644 --- a/src/planner/operator/analyze.rs +++ b/src/planner/operator/analyze.rs @@ -1,6 +1,6 @@ use crate::catalog::TableName; use crate::types::index::IndexMetaRef; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; #[derive(Debug, PartialEq, Eq, Clone, Hash, ReferenceSerialization)] pub struct AnalyzeOperator { diff --git a/src/planner/operator/copy_from_file.rs b/src/planner/operator/copy_from_file.rs index ecaaf5be..fa9455bc 100644 --- a/src/planner/operator/copy_from_file.rs +++ b/src/planner/operator/copy_from_file.rs @@ -1,7 +1,7 @@ use crate::binder::copy::ExtSource; use crate::types::tuple::SchemaRef; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/copy_to_file.rs b/src/planner/operator/copy_to_file.rs index fe5234cc..25b295bc 100644 --- a/src/planner/operator/copy_to_file.rs +++ b/src/planner/operator/copy_to_file.rs @@ -1,5 +1,5 @@ use crate::binder::copy::ExtSource; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; #[derive(Debug, PartialEq, Eq, Clone, Hash, ReferenceSerialization)] pub struct CopyToFileOperator { diff --git a/src/planner/operator/create_index.rs b/src/planner/operator/create_index.rs index 05976d72..3f9e7bfd 100644 --- a/src/planner/operator/create_index.rs +++ b/src/planner/operator/create_index.rs @@ -1,7 +1,7 @@ use crate::catalog::{ColumnRef, TableName}; use crate::types::index::IndexType; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/create_table.rs b/src/planner/operator/create_table.rs index 09e89a16..12535406 100644 --- a/src/planner/operator/create_table.rs +++ b/src/planner/operator/create_table.rs @@ -1,6 +1,6 @@ use crate::catalog::{ColumnCatalog, TableName}; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/create_view.rs b/src/planner/operator/create_view.rs index 3623b3db..9305bf23 100644 --- a/src/planner/operator/create_view.rs +++ b/src/planner/operator/create_view.rs @@ -1,5 +1,5 @@ use crate::catalog::view::View; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/delete.rs b/src/planner/operator/delete.rs index 99bc731d..1d5eabf2 100644 --- a/src/planner/operator/delete.rs +++ b/src/planner/operator/delete.rs @@ -1,5 +1,5 @@ use crate::catalog::{ColumnRef, TableName}; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/describe.rs b/src/planner/operator/describe.rs index d197d7c2..f2f4d0be 100644 --- a/src/planner/operator/describe.rs +++ b/src/planner/operator/describe.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/drop_table.rs b/src/planner/operator/drop_table.rs index 6a8e0519..de054ff0 100644 --- a/src/planner/operator/drop_table.rs +++ b/src/planner/operator/drop_table.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/filter.rs b/src/planner/operator/filter.rs index a4ebdcbf..a32b5080 100644 --- a/src/planner/operator/filter.rs +++ b/src/planner/operator/filter.rs @@ -1,6 +1,6 @@ use crate::expression::ScalarExpression; use crate::planner::LogicalPlan; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt::Formatter; use std::{fmt, vec}; diff --git a/src/planner/operator/function_scan.rs b/src/planner/operator/function_scan.rs index ce2de731..c6652db3 100644 --- a/src/planner/operator/function_scan.rs +++ b/src/planner/operator/function_scan.rs @@ -1,7 +1,7 @@ use crate::expression::function::table::TableFunction; use crate::planner::operator::Operator; use crate::planner::LogicalPlan; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/insert.rs b/src/planner/operator/insert.rs index e084ecf8..a27e3d48 100644 --- a/src/planner/operator/insert.rs +++ b/src/planner/operator/insert.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/join.rs b/src/planner/operator/join.rs index 1508cedb..8cce29d8 100644 --- a/src/planner/operator/join.rs +++ b/src/planner/operator/join.rs @@ -1,8 +1,8 @@ use super::Operator; use crate::expression::ScalarExpression; use crate::planner::LogicalPlan; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; use strum_macros::Display; diff --git a/src/planner/operator/limit.rs b/src/planner/operator/limit.rs index 27125a1e..48bbf596 100644 --- a/src/planner/operator/limit.rs +++ b/src/planner/operator/limit.rs @@ -1,6 +1,6 @@ use super::Operator; use crate::planner::LogicalPlan; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/mod.rs b/src/planner/operator/mod.rs index 095d69f6..4b26bc23 100644 --- a/src/planner/operator/mod.rs +++ b/src/planner/operator/mod.rs @@ -47,8 +47,8 @@ use crate::planner::operator::union::UnionOperator; use crate::planner::operator::update::UpdateOperator; use crate::planner::operator::values::ValuesOperator; use crate::types::index::IndexInfo; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/project.rs b/src/planner/operator/project.rs index cc8722eb..95d244b9 100644 --- a/src/planner/operator/project.rs +++ b/src/planner/operator/project.rs @@ -1,6 +1,6 @@ use crate::expression::ScalarExpression; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/sort.rs b/src/planner/operator/sort.rs index 001a2b47..7080353c 100644 --- a/src/planner/operator/sort.rs +++ b/src/planner/operator/sort.rs @@ -1,6 +1,6 @@ use crate::expression::ScalarExpression; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/table_scan.rs b/src/planner/operator/table_scan.rs index 67cd2772..3f50f972 100644 --- a/src/planner/operator/table_scan.rs +++ b/src/planner/operator/table_scan.rs @@ -4,8 +4,8 @@ use crate::planner::LogicalPlan; use crate::storage::Bounds; use crate::types::index::IndexInfo; use crate::types::ColumnId; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/truncate.rs b/src/planner/operator/truncate.rs index 12dd9aa3..b67646f2 100644 --- a/src/planner/operator/truncate.rs +++ b/src/planner/operator/truncate.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/union.rs b/src/planner/operator/union.rs index 1cf2f5df..67eaf92e 100644 --- a/src/planner/operator/union.rs +++ b/src/planner/operator/union.rs @@ -1,8 +1,8 @@ use crate::planner::operator::Operator; use crate::planner::LogicalPlan; use crate::types::tuple::SchemaRef; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/update.rs b/src/planner/operator/update.rs index 52a2cd9e..37d97626 100644 --- a/src/planner/operator/update.rs +++ b/src/planner/operator/update.rs @@ -1,5 +1,5 @@ use crate::catalog::TableName; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/planner/operator/values.rs b/src/planner/operator/values.rs index 4877ef10..712e1a5c 100644 --- a/src/planner/operator/values.rs +++ b/src/planner/operator/values.rs @@ -1,7 +1,7 @@ use crate::types::tuple::SchemaRef; use crate::types::value::ValueRef; +use fnck_sql_serde_macros::ReferenceSerialization; use itertools::Itertools; -use serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; diff --git a/src/types/index.rs b/src/types/index.rs index a64c5df7..ee153ec5 100644 --- a/src/types/index.rs +++ b/src/types/index.rs @@ -4,7 +4,7 @@ use crate::expression::range_detacher::Range; use crate::expression::ScalarExpression; use crate::types::value::ValueRef; use crate::types::{ColumnId, LogicalType}; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use std::fmt; use std::fmt::Formatter; use std::sync::Arc; diff --git a/src/types/mod.rs b/src/types/mod.rs index 7efcfd76..08c42ffa 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -11,7 +11,7 @@ use std::any::TypeId; use std::cmp; use crate::errors::DatabaseError; -use serde_macros::ReferenceSerialization; +use fnck_sql_serde_macros::ReferenceSerialization; use sqlparser::ast::{CharLengthUnits, ExactNumberInfo, TimezoneInfo}; use strum_macros::AsRefStr; use ulid::Ulid;