{"record":{"id":"68579ae490628664","repo":"perspective-dev/perspective","slug":"unknown-polars-type-dtype","errorCode":null,"errorMessage":"Unknown Polars type '{dtype}'","messagePattern":"Unknown Polars type '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"rust/perspective-python/perspective/virtual_servers/polars.py","lineNumber":317,"sourceCode":"def polars_type_to_psp(dtype):\n    \"\"\"Convert a Polars `dtype` to a Perspective `ColumnType`.\"\"\"\n    if dtype in (pl.Utf8, pl.String):\n        return \"string\"\n    if dtype == pl.Categorical:\n        return \"string\"\n    if dtype in (pl.Int8, pl.Int16, pl.Int32, pl.UInt8, pl.UInt16):\n        return \"integer\"\n    if dtype in (pl.Int64, pl.UInt64, pl.UInt32, pl.Float32, pl.Float64):\n        return \"float\"\n    if dtype == pl.Date:\n        return \"date\"\n    if dtype == pl.Boolean:\n        return \"boolean\"\n    if isinstance(dtype, pl.Datetime) or dtype == pl.Datetime:\n        return \"datetime\"\n\n    msg = f\"Unknown Polars type '{dtype}'\"\n    raise ValueError(msg)\n\n\ndef apply_filters(df, filters):\n    \"\"\"Apply a list of filter configs to a DataFrame.\"\"\"\n    if not filters:\n        return df\n\n    mask = pl.lit(True)\n    for filt in filters:\n        col_name = filt[0]\n        op = filt[1]\n        value = filt[2] if len(filt) > 2 else None\n\n        if value is None:\n            continue\n\n        col_expr = pl.col(col_name)\n        if op == \"==\":","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-python/perspective/virtual_servers/polars.py#L299-L335","documentation":"polars_type_to_psp maps Polars dtypes to Perspective ColumnTypes; when a dtype falls outside the handled set (e.g. pl.List, pl.Struct, pl.Time, pl.Decimal, or Enum), no mapping exists and the virtual server cannot build the schema, so it raises. Generic sentinel ValueError raised by the converter.","triggerScenarios":"Thrown at rust/perspective-python/perspective/virtual_servers/polars.py:317 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Cast unsupported columns before loading, e.g. df.with_columns(pl.col(\"c\").cast(pl.Utf8))","Drop or exclude non-primitive columns (List/Struct) from the table","Extend polars_type_to_psp with a mapping for the missing dtype if it should be supported"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}