databendlabs/databend · error
not implemented
Error message
not implemented
What it means
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'.
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
Example fix
// before
fn serialize(&self) -> Result<Vec<u8>> {
unimplemented!()
}
// after
fn serialize(&self) -> Result<Vec<u8>> {
let metas = self.block_metas.serialize()?;
let summary = serde_json::to_vec(&self.summary)?;
Ok(...) // combine buffers with a length-prefixed framing
} Defensive patterns
Strategy: try-catch
Validate before calling
if seg.supports_serialization() { let bytes = seg.serialize()?; } else { /* rebuild from DataBlock */ } Type guard
fn is_serializable_segment(s: &dyn Segment) -> bool { s.as_any().downcast_ref::<ColumnOrientedSegment>().is_none() } Try / catch
// unimplemented!() panics; cannot be caught as Result
let result = std::panic::catch_unwind(AssertUnwindSafe(|| seg.serialize()));
match result { Ok(Ok(bytes)) => use(bytes), _ => fallback_rebuild(seg) } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- expect tuple type
- S3 params must remain S3
- The header tree can only contain DataHeader
- internal error: entered unreachable code
- not implemented
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/95efe5c2a63b6e20.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/storages/common/table_meta/src/meta/column_oriented_segment/segment.rs:101
for segment in v.iter_mut() {
blocks.append(&mut segment.blocks);
}
Ok(Self::new(blocks, summary))
}
}
impl AbstractSegment for CompactSegmentInfo {
type BlockMeta = BlockMeta;
fn block_metas(&self) -> Result<Vec<Arc<Self::BlockMeta>>> {
self.block_metas()
}
fn summary(&self) -> &Statistics {
&self.summary
}
fn serialize(&self) -> Result<Vec<u8>> {
unimplemented!()
}
fn concat(_v: Vec<Self>, _summary: Statistics) -> Result<Self> {
unimplemented!()
}
}
#[derive(Clone)]
pub struct ColumnOrientedSegment {
pub block_metas: DataBlock,
pub summary: Statistics,
pub segment_schema: TableSchema,
}
impl ColumnOrientedSegment {
pub fn contains_col(&self, col_name: &str) -> bool {
self.segment_schema.column_with_name(col_name).is_some()
}View on GitHub (pinned to 288d84d76e)