cube-js/cube · error
Unable to convert List of {} to string
Error message
Unable to convert List of {} to string What it means
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.
Source
Thrown at rust/cubesql/cubesql/src/sql/dataframe.rs:286
}};
}
match self.v.data_type() {
DataType::Float16 => write_native_array_as_text!(self.v, Float16Array),
DataType::Float32 => write_native_array_as_text!(self.v, Float32Array),
DataType::Float64 => write_native_array_as_text!(self.v, Float64Array),
DataType::Int8 => write_native_array_as_text!(self.v, Int8Array),
DataType::Int16 => write_native_array_as_text!(self.v, Int16Array),
DataType::Int32 => write_native_array_as_text!(self.v, Int32Array),
DataType::Int64 => write_native_array_as_text!(self.v, Int64Array),
DataType::UInt8 => write_native_array_as_text!(self.v, UInt8Array),
DataType::UInt16 => write_native_array_as_text!(self.v, UInt16Array),
DataType::UInt32 => write_native_array_as_text!(self.v, UInt32Array),
DataType::UInt64 => write_native_array_as_text!(self.v, UInt64Array),
DataType::Boolean => write_native_array_as_text!(self.v, BooleanArray),
DataType::Utf8 => write_native_array_as_text!(self.v, StringArray),
DataType::LargeUtf8 => write_native_array_as_text!(self.v, LargeStringArray),
dt => unimplemented!("Unable to convert List of {} to string", dt),
}
"{".to_string() + &values.join(",") + "}"
}
}
macro_rules! convert_array_cast_native {
($V: expr, (Vec<u8>)) => {{
$V.to_vec()
}};
($V: expr, $T: ty) => {{
$V as $T
}};
}
macro_rules! convert_array {
($ARRAY:expr, $NUM_ROWS:expr, $ROWS:expr, $ARRAY_TYPE: ident, $TABLE_TYPE: ident, $NATIVE: tt) => {{
let a = $ARRAY.as_any().downcast_ref::<$ARRAY_TYPE>().unwrap();View on GitHub (pinned to 7d981676b3)
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)
Example fix
// before
dt => unimplemented!("Unable to convert List of {} to string", dt),
// after
DataType::Date32 => write_native_array_as_text!(self.v, Date32Array),
dt => return Err(...format!("Unable to convert List of {} to string", dt)), Defensive patterns
Strategy: validation
Validate before calling
fn is_stringifiable_list(dt: &DataType) -> bool {
matches!(dt, DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 | DataType::UInt16 | DataType::UInt32 | DataType::UInt64 | DataType::Boolean | DataType::Utf8 | DataType::LargeUtf8)
} Type guard
fn as_primitive_element(dt: &DataType) -> Option<&DataType> {
match dt {
DataType::List(field) if matches!(field.data_type(), DataType::Utf8 | DataType::Int64 | DataType::Boolean) => Some(field.data_type()),
_ => None,
}
} Try / catch
let text = std::panic::catch_unwind(|| df_col.to_string())
.map(|s| s)
.unwrap_or_else(|_| "<unprintable list>".to_string()); Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Does not work for standalone mode yet
- Unsupported grouping set type: {:?}
- Unsupported node type: {:?}
- read_variables is not implemented for custom protocol: {:?}
- write_variables is not implemented for custom protocol: {:?}
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/f86e7e8d0646213c.
Report an issue: GitHub.