{"record":{"id":"5556cfded0a3bef4","repo":"cube-js/cube","slug":"unexpected-array-type-when-converting-to-tablevalu","errorCode":null,"errorMessage":"unexpected array type when converting to TableValue: {:?}","messagePattern":"unexpected array type when converting to TableValue: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubestore/cubestore/src/table/mod.rs","lineNumber":115,"sourceCode":"                    .value(row)\n                    .into(),\n            ),\n            DataType::Timestamp(TimeUnit::Microsecond, None) => {\n                TableValue::Timestamp(TimestampValue::new(\n                    1000 * a\n                        .as_any()\n                        .downcast_ref::<TimestampMicrosecondArray>()\n                        .unwrap()\n                        .value(row),\n                ))\n            }\n            DataType::Boolean => TableValue::Boolean(\n                a.as_any()\n                    .downcast_ref::<BooleanArray>()\n                    .unwrap()\n                    .value(row),\n            ),\n            other => panic!(\n                \"unexpected array type when converting to TableValue: {:?}\",\n                other\n            ),\n        }\n    }\n\n    /// Render the value as a string, using `column_type` for context-dependent\n    /// variants (currently `Decimal` / `Decimal96`, where scale lives on the\n    /// column rather than on the value). Falls back to `Display` otherwise.\n    pub fn format_with(&self, column_type: &ColumnType) -> String {\n        match (self, column_type) {\n            (TableValue::Decimal(v), ColumnType::Decimal { scale, .. }) => {\n                v.to_string(*scale as u8)\n            }\n            (TableValue::Decimal96(v), ColumnType::Decimal96 { scale, .. }) => {\n                v.to_string(*scale as u8)\n            }\n            (v, _) => v.to_string(),","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubestore/cubestore/src/table/mod.rs#L97-L133","documentation":"TableValue::from_array converts an Arrow array row into a TableValue, downcasting to the concrete array type matching the DataType. If the DataType isn't one of the supported variants (or the array doesn't match), it panics. It marks an unsupported data type reaching the conversion path.","triggerScenarios":"A query or scan produces an Arrow column whose DataType (e.g. Utf8, List, Dictionary, Decimal in older code) is not one of the handled variants in from_array, typically via a DataFusion expression result being converted to TableValue.","commonSituations":"Using SQL expressions/functions returning types CubeStore doesn't materialize (e.g. LIST/STRUCT); version mismatches between DataFusion and CubeStore changing type mapping; custom scans producing unhandled array types.","solutions":["Avoid selecting/returning unsupported types (lists, structs, dictionaries) from CubeStore queries; cast to a supported type (Utf8, Int, Float, Timestamp, Boolean)","Cast unsupported expression results in SQL, e.g. CAST(col AS VARCHAR)","Check CubeStore version — type support is added over time; upgrade if a supported type still fails","Report as a bug with the query if a basic type (e.g. Utf8) is missing from the match"],"exampleFix":"// before\nSELECT array_agg(id) FROM t; // List type\n// after\nSELECT CAST(array_agg(id) AS VARCHAR) FROM t;","handlingStrategy":"type-guard","validationCode":"fn is_supported(dt: &DataType) -> bool {\n    matches!(dt, DataType::Int8 | DataType::Int32 | DataType::Int64 | DataType::Float64 | DataType::Utf8 | DataType::Boolean | DataType::Timestamp(_, _))\n}","typeGuard":"fn supported_array(a: &dyn Array) -> Option<&DataType> {\n    let dt = a.data_type();\n    if matches!(dt, DataType::List(_) | DataType::Struct(_) | DataType::Dictionary(_, _)) { None } else { Some(dt) }\n}","tryCatchPattern":null,"preventionTips":["Cast unsupported expression results to VARCHAR/scalars before returning from CubeStore","Avoid selecting LIST/STRUCT columns through CubeStore","Pin compatible DataFusion/CubeStore versions"],"tags":["cubestore","panic","arrow","unsupported-type"],"backgroundTag":"unsupported-data-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}