Skip to content

Commit 9efea7f

Browse files
authored
Merge pull request #7556 from andylokandy/codegen
refactor(expr): codegen function registers
2 parents fd47c3b + 2aa7b94 commit 9efea7f

File tree

12 files changed

+4838
-866
lines changed

12 files changed

+4838
-866
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/query/codegen/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ path = "src/bin/codegen.rs"
1818
common-datavalues = { path = "../datavalues" }
1919
common-expression = { path = "../expression" }
2020

21+
itertools = "0.10"
2122
serde = { version = "1.0.137", features = ["derive"] }
2223
serde_json = "1.0.81"

src/query/codegen/src/bin/codegen.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use codegen::writes::codegen_arithmetic_type;
16-
use codegen::writes::codegen_arithmetic_type_v2;
17-
1815
fn main() {
19-
codegen_arithmetic_type();
20-
codegen_arithmetic_type_v2();
16+
codegen::writes::codegen_arithmetic_type();
17+
codegen::writes::codegen_arithmetic_type_v2();
18+
codegen::writes::codegen_register();
2119
}

src/query/codegen/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#![feature(exit_status_error)]
16+
1517
pub mod writes;

src/query/codegen/src/writes/arithmetics_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn codegen_arithmetic_type() {
2525
use DataValueBinaryOperator::*;
2626
use DataValueUnaryOperator::*;
2727

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

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

src/query/codegen/src/writes/arithmetics_type_v2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ pub fn codegen_arithmetic_type_v2() {
3535
let path = dest.join("arithmetics_type.rs");
3636

3737
let mut file = File::create(&path).expect("open");
38+
3839
// Write the head.
40+
let codegen_src = file!();
3941
writeln!(
4042
file,
4143
"// Copyright 2021 Datafuse Labs.
@@ -52,7 +54,7 @@ pub fn codegen_arithmetic_type_v2() {
5254
// See the License for the specific language governing permissions and
5355
// limitations under the License.
5456
55-
// This code is generated by common/codegen. DO NOT EDIT.
57+
// This code is generated by {codegen_src}. DO NOT EDIT.
5658
use super::number::Number;
5759
5860
pub trait ResultTypeOfBinary: Sized {{

src/query/codegen/src/writes/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
mod arithmetics_type;
1616
mod arithmetics_type_v2;
17+
mod register;
1718

1819
pub use arithmetics_type::*;
1920
pub use arithmetics_type_v2::*;
21+
pub use register::*;

0 commit comments

Comments
 (0)