Skip to content

Commit

Permalink
add const_case_when_eval_rule & const_case_when_rewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed Feb 2, 2024
1 parent 8fdd0ba commit 03c3f69
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/frontend/src/binder/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ impl Binder {
constant_lookup_inputs.push(input);
} else {
// If at least one condition is not in the simple form / not constant,
// we can NOT do the subsequent optimization then
// we can NOT do the subsequent optimization pass
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2024 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
29 changes: 29 additions & 0 deletions src/frontend/src/optimizer/rule/const_case_when_eval_rule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2024 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::super::plan_node::*;
use super::{BoxedRule, Rule};

pub struct ConstCaseWhenEvalRule {}
impl Rule for ConstCaseWhenEvalRule {
fn apply(&self, plan: PlanRef) -> Option<PlanRef> {
todo!()
}
}

impl ConstCaseWhenEvalRule {
pub fn create() -> BoxedRule {
Box::new(ConstCaseWhenEvalRule {})
}
}

0 comments on commit 03c3f69

Please sign in to comment.