From d5504325fba81c996a95457cfe1e45cd7a713e24 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Tue, 9 Jan 2024 18:21:25 +0800 Subject: [PATCH] use FrameBound variants to make code clean Signed-off-by: Richard Chien --- src/expr/core/src/window_function/call.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/expr/core/src/window_function/call.rs b/src/expr/core/src/window_function/call.rs index 57020e1841fa8..7822ed07c5a93 100644 --- a/src/expr/core/src/window_function/call.rs +++ b/src/expr/core/src/window_function/call.rs @@ -20,6 +20,7 @@ use risingwave_common::bail; use risingwave_common::types::DataType; use risingwave_pb::expr::window_frame::{PbBound, PbExclusion}; use risingwave_pb::expr::{PbWindowFrame, PbWindowFunction}; +use FrameBound::{CurrentRow, Following, Preceding, UnboundedFollowing, UnboundedPreceding}; use super::WindowFuncKind; use crate::aggregate::AggArgs; @@ -176,7 +177,6 @@ pub enum FrameBound { impl FrameBound { fn validate_bounds(start: &Self, end: &Self) -> Result<()> { - use FrameBound::*; match (start, end) { (_, UnboundedPreceding) => bail!("frame end cannot be UNBOUNDED PRECEDING"), (UnboundedFollowing, _) => bail!("frame start cannot be UNBOUNDED FOLLOWING"), @@ -234,10 +234,10 @@ impl FrameBound { /// Convert the bound to sized offset from current row. `None` if the bound is unbounded. pub fn to_offset(&self) -> Option { match self { - FrameBound::UnboundedPreceding | FrameBound::UnboundedFollowing => None, - FrameBound::CurrentRow => Some(0), - FrameBound::Preceding(n) => Some(-(*n as isize)), - FrameBound::Following(n) => Some(*n as isize), + UnboundedPreceding | UnboundedFollowing => None, + CurrentRow => Some(0), + Preceding(n) => Some(-(*n as isize)), + Following(n) => Some(*n as isize), } }