{"record":{"id":"95efe5c2a63b6e20","repo":"databendlabs/databend","slug":"not-implemented-95efe5","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/storages/common/table_meta/src/meta/column_oriented_segment/segment.rs","lineNumber":101,"sourceCode":"        for segment in v.iter_mut() {\n            blocks.append(&mut segment.blocks);\n        }\n        Ok(Self::new(blocks, summary))\n    }\n}\n\nimpl AbstractSegment for CompactSegmentInfo {\n    type BlockMeta = BlockMeta;\n    fn block_metas(&self) -> Result<Vec<Arc<Self::BlockMeta>>> {\n        self.block_metas()\n    }\n\n    fn summary(&self) -> &Statistics {\n        &self.summary\n    }\n\n    fn serialize(&self) -> Result<Vec<u8>> {\n        unimplemented!()\n    }\n\n    fn concat(_v: Vec<Self>, _summary: Statistics) -> Result<Self> {\n        unimplemented!()\n    }\n}\n\n#[derive(Clone)]\npub struct ColumnOrientedSegment {\n    pub block_metas: DataBlock,\n    pub summary: Statistics,\n    pub segment_schema: TableSchema,\n}\n\nimpl ColumnOrientedSegment {\n    pub fn contains_col(&self, col_name: &str) -> bool {\n        self.segment_schema.column_with_name(col_name).is_some()\n    }","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/storages/common/table_meta/src/meta/column_oriented_segment/segment.rs#L83-L119","documentation":"This panic comes from an explicit `unimplemented!()` in `ColumnOrientedSegment::serialize`. The column-oriented segment type exists only as an in-memory container (a DataBlock of block metas plus statistics) and was never given a serialization path, so any code that tries to persist or encode it panics with 'not implemented'.","triggerScenarios":"Calling `serialize()` on a `ColumnOrientedSegment`, e.g. when a code path tries to write the segment to a serialized location or round-trip it through the Segment trait's binary form.","commonSituations":"A developer builds a custom catalog or cache layer that requires Segment serialization; a new feature routes column-oriented segments through a path that only column (not row) segments were expected to skip; refactoring wires the segment into a persistence API.","solutions":["Do not call `serialize()` on ColumnOrientedSegment; reconstruct it from its DataBlock instead","If serialization is required, implement it: encode `block_metas` (e.g. via its arrow/serde path) plus `summary` into a Vec<u8> and mirror the logic in `deserialize`","Replace the segment representation with a type that supports serialization (e.g. the row-oriented Segment) if the code path requires the trait"],"exampleFix":"// before\nfn serialize(&self) -> Result<Vec<u8>> {\n    unimplemented!()\n}\n// after\nfn serialize(&self) -> Result<Vec<u8>> {\n    let metas = self.block_metas.serialize()?;\n    let summary = serde_json::to_vec(&self.summary)?;\n    Ok(...) // combine buffers with a length-prefixed framing\n}","handlingStrategy":"try-catch","validationCode":"if seg.supports_serialization() { let bytes = seg.serialize()?; } else { /* rebuild from DataBlock */ }","typeGuard":"fn is_serializable_segment(s: &dyn Segment) -> bool { s.as_any().downcast_ref::<ColumnOrientedSegment>().is_none() }","tryCatchPattern":"// unimplemented!() panics; cannot be caught as Result\nlet result = std::panic::catch_unwind(AssertUnwindSafe(|| seg.serialize()));\nmatch result { Ok(Ok(bytes)) => use(bytes), _ => fallback_rebuild(seg) }","preventionTips":["Check whether a Segment impl stubs serialize/concat before routing it through persistence paths","Special-case ColumnOrientedSegment in generic segment-processing code","Add compile-time capability flags to segment types instead of relying on trait defaults"],"tags":["rust","unimplemented","storage","segment"],"backgroundTag":"method-not-implemented","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}