{"record":{"id":"80f9dbd161618ea6","repo":"cube-js/cube","slug":"can-t-compare-to-80f9db","errorCode":null,"errorMessage":"Can't compare {:?} to {:?}","messagePattern":"Can't compare (.+?) to (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/table/mod.rs","lineNumber":231,"sourceCode":"\n    pub fn values(&self) -> &Vec<TableValue> {\n        &self.values\n    }\n}\n\npub fn cmp_same_types(l: &TableValue, r: &TableValue) -> Ordering {\n    match (l, r) {\n        (TableValue::Null, TableValue::Null) => Ordering::Equal,\n        (TableValue::Null, _) => Ordering::Less,\n        (_, TableValue::Null) => Ordering::Greater,\n        (TableValue::String(a), TableValue::String(b)) => a.cmp(b),\n        (TableValue::Int(a), TableValue::Int(b)) => a.cmp(b),\n        (TableValue::Decimal(a), TableValue::Decimal(b)) => a.cmp(b),\n        (TableValue::Float(a), TableValue::Float(b)) => a.cmp(b),\n        (TableValue::Bytes(a), TableValue::Bytes(b)) => a.cmp(b),\n        (TableValue::Timestamp(a), TableValue::Timestamp(b)) => a.cmp(b),\n        (TableValue::Boolean(a), TableValue::Boolean(b)) => a.cmp(b),\n        (a, b) => panic!(\"Can't compare {:?} to {:?}\", a, b),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use crate::table::{TableValue, TimestampValue};\n    use crate::util::decimal::Decimal;\n    use deepsize::DeepSizeOf;\n    use serde::{Deserialize, Serialize};\n\n    #[test]\n    fn serialization() {\n        for v in &[\n            TableValue::Null,\n            TableValue::String(\"foo\".into()),\n            TableValue::Int(123),\n            TableValue::Decimal(Decimal::new(123)),\n            TableValue::Float(12_f64.into()),","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/table/mod.rs#L213-L249","documentation":"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.","triggerScenarios":"Comparing TableValue::Int with TableValue::String (or any mixed pair) in sort/filter/min-max logic that assumes homogeneous column values.","commonSituations":"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.","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"],"exampleFix":"// before\ncmp_same_types(&TableValue::Int(1), &TableValue::String(\"1\".into()))\n// after\ncmp_same_types(&TableValue::Int(1), &TableValue::Int(1))","handlingStrategy":"validation","validationCode":null,"typeGuard":"fn same_variant(a: &TableValue, b: &TableValue) -> bool {\n    std::mem::discriminant(a) == std::mem::discriminant(b)\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["cubestore","panic","type-mismatch","comparison"],"backgroundTag":"type-mismatch-panic","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}