Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(expr): codegen function registers #7556

Merged
merged 3 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions src/query/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ path = "src/bin/codegen.rs"
common-datavalues = { path = "../datavalues" }
common-expression = { path = "../expression" }

itertools = "0.10"
serde = { version = "1.0.137", features = ["derive"] }
serde_json = "1.0.81"
8 changes: 3 additions & 5 deletions src/query/codegen/src/bin/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use codegen::writes::codegen_arithmetic_type;
use codegen::writes::codegen_arithmetic_type_v2;

fn main() {
codegen_arithmetic_type();
codegen_arithmetic_type_v2();
codegen::writes::codegen_arithmetic_type();
codegen::writes::codegen_arithmetic_type_v2();
codegen::writes::codegen_register();
}
2 changes: 2 additions & 0 deletions src/query/codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![feature(exit_status_error)]

pub mod writes;
2 changes: 1 addition & 1 deletion src/query/codegen/src/writes/arithmetics_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn codegen_arithmetic_type() {
use DataValueBinaryOperator::*;
use DataValueUnaryOperator::*;

let dest = Path::new("src/common/datavalues/src/types");
let dest = Path::new("src/query/datavalues/src/types");
let path = dest.join("arithmetics_type.rs");

let mut file = File::create(&path).expect("open");
Expand Down
4 changes: 3 additions & 1 deletion src/query/codegen/src/writes/arithmetics_type_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ pub fn codegen_arithmetic_type_v2() {
let path = dest.join("arithmetics_type.rs");

let mut file = File::create(&path).expect("open");

// Write the head.
let codegen_src = file!();
writeln!(
file,
"// Copyright 2021 Datafuse Labs.
Expand All @@ -52,7 +54,7 @@ pub fn codegen_arithmetic_type_v2() {
// See the License for the specific language governing permissions and
// limitations under the License.

// This code is generated by common/codegen. DO NOT EDIT.
// This code is generated by {codegen_src}. DO NOT EDIT.
use super::number::Number;

pub trait ResultTypeOfBinary: Sized {{
Expand Down
2 changes: 2 additions & 0 deletions src/query/codegen/src/writes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

mod arithmetics_type;
mod arithmetics_type_v2;
mod register;

pub use arithmetics_type::*;
pub use arithmetics_type_v2::*;
pub use register::*;
Loading