{"record":{"id":"e708f0bf7f839e98","repo":"risingwavelabs/risingwave","slug":"unspecified-type-of-rangeframebound","errorCode":null,"errorMessage":"unspecified type of `RangeFrameBound`","messagePattern":"unspecified type of `RangeFrameBound`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/expr/core/src/window_function/range.rs","lineNumber":236,"sourceCode":"    /// It's very similar to `first_curr_of`, just with everything on the other direction.\n    pub fn last_curr_of(&self, order_value: impl ToOwnedDatum) -> Sentinelled<Datum> {\n        self.start\n            .for_calc()\n            .reverse()\n            .bound_of(order_value, self.order_type)\n    }\n}\n\npub type RangeFrameBound = FrameBound<RangeFrameOffset>;\n\nimpl RangeFrameBound {\n    fn from_protobuf(\n        bound: &PbRangeFrameBound,\n        order_data_type: &DataType,\n        offset_data_type: &DataType,\n    ) -> Result<Self> {\n        let bound = match bound.get_type()? {\n            PbBoundType::Unspecified => bail!(\"unspecified type of `RangeFrameBound`\"),\n            PbBoundType::UnboundedPreceding => Self::UnboundedPreceding,\n            PbBoundType::CurrentRow => Self::CurrentRow,\n            PbBoundType::UnboundedFollowing => Self::UnboundedFollowing,\n            bound_type @ (PbBoundType::Preceding | PbBoundType::Following) => {\n                let offset_value = Datum::from_protobuf(bound.get_offset()?, offset_data_type)\n                    .context(\"offset `Datum` is not decodable\")?\n                    .context(\"offset of `RangeFrameBound` must be non-NULL\")?;\n                let mut offset = RangeFrameOffset::new(offset_value);\n                offset.prepare(order_data_type, offset_data_type)?;\n                if bound_type == PbBoundType::Preceding {\n                    Self::Preceding(offset)\n                } else {\n                    Self::Following(offset)\n                }\n            }\n        };\n        Ok(bound)\n    }","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/window_function/range.rs#L218-L254","documentation":"RangeFrameBound::from_protobuf requires the bound type discriminant to be one of UnboundedPreceding/CurrentRow/UnboundedFollowing/Preceding/Following. An Unspecified type carries no meaning, so the conversion errors instead of defaulting.","triggerScenarios":"Deserializing a PbRangeFrameBound whose get_type() returns Unspecified — the bound type field was not set in the protobuf plan message.","commonSituations":"Frontend omitted the bound type when building the WindowFunction proto, an older protocol version, or hand-crafted test protobufs.","solutions":["Set the bound type explicitly in the frontend when constructing PbRangeFrameBound.","Ensure the plan producer fills every frame bound's type before serialization.","Inspect the serialized plan for unset oneof fields in frame bounds."],"exampleFix":"// before\nbound.set_type(PbBoundType::Unspecified);\n// after\nbound.set_type(PbBoundType::Preceding);","handlingStrategy":"validation","validationCode":"fn bound_type_is_set(b: &PbRangeFrameBound) -> bool { b.get_type().map(|t| !matches!(t, PbBoundType::Unspecified)).unwrap_or(false) }","typeGuard":"fn is_specified_bound(t: PbBoundType) -> bool { !matches!(t, PbBoundType::Unspecified) }","tryCatchPattern":"let bound = match RangeFrameBound::from_protobuf(&pb_bound, &order_type, &offset_type) {\n    Ok(b) => b,\n    Err(e) => return Err(e.context(\"malformed RANGE frame bound in plan\")),\n};","preventionTips":["Always set the bound type oneof when building PbRangeFrameBound.","Default UnboundedPreceding/CurrentRow explicitly in the binder.","Add proto round-trip tests for frame bounds."],"tags":["window-function","protobuf","enum","deserialization"],"backgroundTag":"invalid-enum-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}