databendlabs/databend · error
column view storage type mismatch
Error message
column view storage type mismatch
What it means
push_typed downcasts the column storage's underlying Any data to Vec<ColumnView<T>> for the compile-time type T of the pushed entry. The expect panics when the storage holds views of a different type than the handler's T — the storage type and the entry type disagree, an internal type-tag invariant violation.
Solutions
- Verify the entry's data type matches the storage's declared data_type before pushing.
- Ensure handler_for and storage construction use the same (fully unwrapped, non-nullable-normalized) DataType.
- Check for schema mismatch upstream: a query or insert supplying values of the wrong type should be rejected earlier.
- File a bug with the query/types involved; this is an internal invariant violation.
Defensive patterns
Strategy: type-guard
Validate before calling
if entry.data_type() != &storage.data_type {
return Err(ErrorCode::Internal("pushed entry type does not match column storage type"));
} Type guard
fn matches_storage<T: AccessType>(storage: &ColumnStorage, entry: &BlockEntry) -> bool {
entry.data_type() == &storage.data_type && storage.data.downcast_ref::<Vec<ColumnView<T>>>().is_some()
} Prevention
- Build TypeHandlers and storage from the same normalized DataType
- Type-check inputs at the query boundary before they reach column storage
- Cover push paths with type-mismatch unit tests
When it happens
Trigger: Calling push_typed (via BlockVec push paths) with an entry whose AccessType T does not match the type the ColumnStorage was created with — e.g. handler lookup used one DataType while the storage was initialized with another.
Common situations: Bugs in type-handler dispatch (handler_for returning the wrong specialization), schema/type changes not propagated to existing column storage, or expressions producing values of a different type than the declared column type.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- column view type mismatch
- internal error: entered unreachable code
- {}
- Temp table id used up
- Invalid temp table desc
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/98eb116273f9b967.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/expression/src/block_vec.rs:438
DataBlock::new(entries, 0)
}
fn init_typed<T: AccessType>(entry: BlockEntry, size_hit: usize) -> Result<ColumnStorage> {
let data_type = entry.data_type();
let mut data = Box::new(Vec::<ColumnView<T>>::with_capacity(size_hit));
data.push(entry.downcast::<T>()?);
Ok(ColumnStorage {
data_type,
data: data as _,
})
}
fn push_typed<T: AccessType>(storage: &mut ColumnStorage, entry: BlockEntry) -> Result<()> {
let views = storage
.data
.downcast_mut::<Vec<ColumnView<T>>>()
.expect("column view storage type mismatch");
views.push(entry.downcast::<T>()?);
Ok(())
}
fn replace_typed<T: AccessType>(storage: &mut ColumnStorage, index: usize, entry: BlockEntry) {
let views = storage
.data
.downcast_mut::<Vec<ColumnView<T>>>()
.expect("column view storage type mismatch");
let view = entry.downcast::<T>().expect("column view type mismatch");
views[index] = view;
}
fn handler_for(data_type: &DataType) -> TypeHandler {
match data_type {
DataType::Nullable(inner) => Self::handler_for_nullable(inner),
_ => Self::handler_for_non_nullable(data_type),
}View on GitHub (pinned to 288d84d76e)