{"record":{"id":"f86e7e8d0646213c","repo":"cube-js/cube","slug":"unable-to-convert-list-of-to-string","errorCode":null,"errorMessage":"Unable to convert List of {} to string","messagePattern":"Unable to convert List of (.+?) to string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cubesql/cubesql/src/sql/dataframe.rs","lineNumber":286,"sourceCode":"            }};\n        }\n\n        match self.v.data_type() {\n            DataType::Float16 => write_native_array_as_text!(self.v, Float16Array),\n            DataType::Float32 => write_native_array_as_text!(self.v, Float32Array),\n            DataType::Float64 => write_native_array_as_text!(self.v, Float64Array),\n            DataType::Int8 => write_native_array_as_text!(self.v, Int8Array),\n            DataType::Int16 => write_native_array_as_text!(self.v, Int16Array),\n            DataType::Int32 => write_native_array_as_text!(self.v, Int32Array),\n            DataType::Int64 => write_native_array_as_text!(self.v, Int64Array),\n            DataType::UInt8 => write_native_array_as_text!(self.v, UInt8Array),\n            DataType::UInt16 => write_native_array_as_text!(self.v, UInt16Array),\n            DataType::UInt32 => write_native_array_as_text!(self.v, UInt32Array),\n            DataType::UInt64 => write_native_array_as_text!(self.v, UInt64Array),\n            DataType::Boolean => write_native_array_as_text!(self.v, BooleanArray),\n            DataType::Utf8 => write_native_array_as_text!(self.v, StringArray),\n            DataType::LargeUtf8 => write_native_array_as_text!(self.v, LargeStringArray),\n            dt => unimplemented!(\"Unable to convert List of {} to string\", dt),\n        }\n\n        \"{\".to_string() + &values.join(\",\") + \"}\"\n    }\n}\n\nmacro_rules! convert_array_cast_native {\n    ($V: expr, (Vec<u8>)) => {{\n        $V.to_vec()\n    }};\n    ($V: expr, $T: ty) => {{\n        $V as $T\n    }};\n}\n\nmacro_rules! convert_array {\n    ($ARRAY:expr, $NUM_ROWS:expr, $ROWS:expr, $ARRAY_TYPE: ident, $TABLE_TYPE: ident, $NATIVE: tt) => {{\n        let a = $ARRAY.as_any().downcast_ref::<$ARRAY_TYPE>().unwrap();","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cubesql/cubesql/src/sql/dataframe.rs#L268-L304","documentation":"DataFrame::to_string formats an array column into bracketed text, but only handles native numeric, boolean, and UTF-8 array element types. Any other DataType (nested lists, structs, decimals, dates as list elements) hits the catch-all unimplemented! arm.","triggerScenarios":"Converting a List column whose element DataType is not one of the explicitly supported native types (Int8-64, UInt16-64, Boolean, Utf8, LargeUtf8) — e.g. a list of dates, decimals, or nested lists.","commonSituations":"Rendering query results containing nested/nonscalar array columns over the CubeSQL protocol; often after schema changes introduce typed arrays (e.g. ARRAY<DATE>) that the text formatting path was never extended for.","solutions":["Cast or unnest the array column so its elements are primitive types before rendering","Flatten nested arrays into rows instead of stringifying them","Extend write path: add a match arm in dataframe.rs (line ~286) mapping the missing DataType to its Arrow array constructor","Change the underlying schema so list elements are primitive (int/bool/string)"],"exampleFix":"// before\ndt => unimplemented!(\"Unable to convert List of {} to string\", dt),\n// after\nDataType::Date32 => write_native_array_as_text!(self.v, Date32Array),\ndt => return Err(...format!(\"Unable to convert List of {} to string\", dt)),","handlingStrategy":"validation","validationCode":"fn is_stringifiable_list(dt: &DataType) -> bool {\n    matches!(dt, DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 | DataType::UInt16 | DataType::UInt32 | DataType::UInt64 | DataType::Boolean | DataType::Utf8 | DataType::LargeUtf8)\n}","typeGuard":"fn as_primitive_element(dt: &DataType) -> Option<&DataType> {\n    match dt {\n        DataType::List(field) if matches!(field.data_type(), DataType::Utf8 | DataType::Int64 | DataType::Boolean) => Some(field.data_type()),\n        _ => None,\n    }\n}","tryCatchPattern":"let text = std::panic::catch_unwind(|| df_col.to_string())\n    .map(|s| s)\n    .unwrap_or_else(|_| \"<unprintable list>\".to_string());","preventionTips":["Keep list element types primitive in data models","Unnest arrays before rendering to text/protocol output","Cast unsupported element types (dates, decimals) to strings in SQL before returning","Add a test per DataType variant for to_string formatting"],"tags":["rust","arrays","serialization","unimplemented"],"backgroundTag":"unsupported-data-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}