Skip to content

Commit

Permalink
fix watermark derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangjinwu committed Oct 5, 2023
1 parent 5b4971f commit cdde515
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/frontend/src/expr/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,16 @@ impl WatermarkAnalyzer {
use WatermarkDerivation::{Constant, Nondecreasing, Watermark};
match func_call.func_type() {
ExprType::Unspecified => unreachable!(),
ExprType::Add => match self.visit_binary_op(func_call.inputs()) {
(Constant, Constant) => Constant,
(Constant, Watermark(idx)) | (Watermark(idx), Constant) => Watermark(idx),
(Constant, Nondecreasing) | (Nondecreasing, Constant) => Nondecreasing,
_ => WatermarkDerivation::None,
},
ExprType::Subtract | ExprType::TumbleStart => {
match self.visit_binary_op(func_call.inputs()) {
ExprType::Add | ExprType::AddWithTimeZone => {
match self.visit_binary_op(&func_call.inputs()[..2]) {
(Constant, Constant) => Constant,
(Constant, Watermark(idx)) | (Watermark(idx), Constant) => Watermark(idx),
(Constant, Nondecreasing) | (Nondecreasing, Constant) => Nondecreasing,
_ => WatermarkDerivation::None,
}
}
ExprType::Subtract | ExprType::SubtractWithTimeZone | ExprType::TumbleStart => {
match self.visit_binary_op(&func_call.inputs()[..2]) {
(Constant, Constant) => Constant,
(Watermark(idx), Constant) => Watermark(idx),
(Nondecreasing, Constant) => Nondecreasing,
Expand Down

0 comments on commit cdde515

Please sign in to comment.