Skip to content

Commit 4d2ec13

Browse files
committed
feat: add Visitor & 'VisitorMut' to simply ScalarExpression visit
1 parent e32ef34 commit 4d2ec13

File tree

11 files changed

+1058
-836
lines changed

11 files changed

+1058
-836
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ ordered-float = { version = "4", features = ["serde"] }
4949
paste = { version = "1" }
5050
parking_lot = { version = "0.12", features = ["arc_lock"] }
5151
petgraph = { version = "0.6" }
52+
recursive = { version = "0.1" }
5253
regex = { version = "1" }
5354
rocksdb = { version = "0.22" }
5455
rust_decimal = { version = "1" }

src/binder/insert.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use crate::binder::{lower_case_name, Binder};
22
use crate::errors::DatabaseError;
3+
use crate::expression::simplify::ConstantCalculator;
4+
use crate::expression::visitor_mut::VisitorMut;
35
use crate::expression::ScalarExpression;
46
use crate::planner::operator::insert::InsertOperator;
57
use crate::planner::operator::values::ValuesOperator;
@@ -69,8 +71,8 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
6971

7072
for (i, expr) in expr_row.iter().enumerate() {
7173
let mut expression = self.bind_expr(expr)?;
72-
73-
expression.constant_calculation()?;
74+
75+
ConstantCalculator.visit(&mut expression)?;
7476
match expression {
7577
ScalarExpression::Constant(value) => {
7678
let ty = schema_ref[i].datatype();

src/binder/select.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use crate::planner::{Childrens, LogicalPlan, SchemaOutput};
3333
use crate::storage::Transaction;
3434
use crate::types::tuple::{Schema, SchemaRef};
3535
use crate::types::value::Utf8Type;
36-
use crate::types::LogicalType::Char;
3736
use crate::types::{ColumnId, LogicalType};
3837
use itertools::Itertools;
3938
use sqlparser::ast::{

0 commit comments

Comments
 (0)