cube-js/cube · error

Unsupported data type: {:?}

Error message

Unsupported data type: {:?}

What it means

batches_to_dataframe converts Arrow RecordBatches into CubeSQL's internal DataFrame. Any column whose Arrow DataType has no mapping to a TableValue variant (anything beyond the supported set, where DataType::Null and other known types are handled explicitly) hits the catch-all `x => panic!("Unsupported data type: {:?}")`.

Source

Thrown at rust/cubesql/cubesql/src/sql/dataframe.rs:591

                    }
                }
                DataType::List(_) => {
                    let a = array.as_any().downcast_ref::<ListArray>().unwrap();

                    for i in 0..num_rows {
                        rows[i].push(if a.is_null(i) {
                            TableValue::Null
                        } else {
                            TableValue::List(ListValue::new(a.value(i)))
                        });
                    }
                }
                DataType::Null => {
                    for i in 0..num_rows {
                        rows[i].push(TableValue::Null)
                    }
                }
                x => panic!("Unsupported data type: {:?}", x),
            }
        }
        all_rows.append(&mut rows);
    }

    Ok(DataFrame::new(cols, all_rows))
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_dataframe_print() {
        let frame = DataFrame::new(
            vec![Column::new(
                "test".to_string(),
                ColumnType::String,

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Cast the offending column to a supported type in the query (e.g. CAST(col AS VARCHAR) or to DOUBLE)
  2. Identify the type from the panic payload's Debug output and add a mapping arm in batches_to_dataframe
  3. Pre-aggregate or reshape the column upstream so only primitives reach CubeSQL

Example fix

// before
SELECT prices FROM trades
// after
SELECT CAST(prices AS DOUBLE) AS prices FROM trades
Defensive patterns

Strategy: type-guard

Validate before calling

fn is_supported_arrow_type(dt: &arrow::datatypes::DataType) -> bool {
    use arrow::datatypes::DataType::*;
    matches!(
        dt,
        Null | Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64
            | Float32 | Float64 | Utf8 | LargeUtf8 | Boolean
            | Timestamp(_, _)
    )
}
// check each batch column before conversion
for f in batch.schema().fields() {
    assert!(is_supported_arrow_type(f.data_type()), "unsupported: {:?}", f.data_type());
}

Type guard

fn is_supported_arrow_type(dt: &arrow::datatypes::DataType) -> bool {
    use arrow::datatypes::DataType::*;
    matches!(dt, Null | Int8 | Int16 | Int32 | Int64 | Float32 | Float64 | Utf8 | Boolean | Timestamp(_, _))
}

Prevention

When it happens

Trigger: A query result stream from the data source produces an Arrow column type not covered by the conversion (e.g. Decimal128, List, Struct, Dictionary, Map) and is converted via batches_to_dataframe.

Common situations: Querying a column of an exotic DB type (DECIMAL with high precision, arrays, JSON) through the SQL interface; driver version changes producing new Arrow types.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/078605c3f6e9dd8a. Report an issue: GitHub.