cube-js/cube · error
Can't compare {:?} to {:?}
Error message
Can't compare {:?} to {:?} What it means
Same family as error 620 but for owned TableValue (not the row-reference variant): cmp_same_types only compares equal-variant pairs and panics on mixed types. Reaching it means two values of different logical types were compared where the caller assumed the same column type.
Source
Thrown at rust/cubestore/cubestore/src/table/mod.rs:231
pub fn values(&self) -> &Vec<TableValue> {
&self.values
}
}
pub fn cmp_same_types(l: &TableValue, r: &TableValue) -> Ordering {
match (l, r) {
(TableValue::Null, TableValue::Null) => Ordering::Equal,
(TableValue::Null, _) => Ordering::Less,
(_, TableValue::Null) => Ordering::Greater,
(TableValue::String(a), TableValue::String(b)) => a.cmp(b),
(TableValue::Int(a), TableValue::Int(b)) => a.cmp(b),
(TableValue::Decimal(a), TableValue::Decimal(b)) => a.cmp(b),
(TableValue::Float(a), TableValue::Float(b)) => a.cmp(b),
(TableValue::Bytes(a), TableValue::Bytes(b)) => a.cmp(b),
(TableValue::Timestamp(a), TableValue::Timestamp(b)) => a.cmp(b),
(TableValue::Boolean(a), TableValue::Boolean(b)) => a.cmp(b),
(a, b) => panic!("Can't compare {:?} to {:?}", a, b),
}
}
#[cfg(test)]
mod tests {
use crate::table::{TableValue, TimestampValue};
use crate::util::decimal::Decimal;
use deepsize::DeepSizeOf;
use serde::{Deserialize, Serialize};
#[test]
fn serialization() {
for v in &[
TableValue::Null,
TableValue::String("foo".into()),
TableValue::Int(123),
TableValue::Decimal(Decimal::new(123)),
TableValue::Float(12_f64.into()),View on GitHub (pinned to 7d981676b3)
Solutions
- Ensure consistent column types across all partitions of a table and rebuild inconsistent partitions
- Coerce values to a common type before comparison in custom code paths
- Audit import pipelines for values that break declared types
- File a bug with repro if triggered by standard queries
Example fix
// before
cmp_same_types(&TableValue::Int(1), &TableValue::String("1".into()))
// after
cmp_same_types(&TableValue::Int(1), &TableValue::Int(1)) Defensive patterns
Strategy: validation
Type guard
fn same_variant(a: &TableValue, b: &TableValue) -> bool {
std::mem::discriminant(a) == std::mem::discriminant(b)
} Prevention
- Ensure all partitions of a table share the same schema
- Validate imported values against declared types
- Guard comparisons with same_variant before calling cmp_same_types
When it happens
Trigger: Comparing TableValue::Int with TableValue::String (or any mixed pair) in sort/filter/min-max logic that assumes homogeneous column values.
Common situations: Mixed-type data inside one logical column after import or partition merge; planner bugs comparing values from different typed columns; union of partitions with divergent schemas.
Related errors
- Can't compare {:?} to {:?}
- unexpected value {:?} for type {:?}
- CacheStore cannot be used on the worker node! queue_retrieve
- CacheStore cannot be used on the worker node! queue_ack was
- CacheStore cannot be used on the worker node! queue_result w
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/80f9dbd161618ea6.
Report an issue: GitHub.