{"record":{"id":"11146ea2a8d4c09b","repo":"perspective-dev/perspective","slug":"unknown-type-name","errorCode":null,"errorMessage":"Unknown type '${name}'","messagePattern":"Unknown type '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/perspective-js/src/ts/virtual_servers/clickhouse.ts","lineNumber":159,"sourceCode":"    }\n\n    if (name === \"Int64\" || name === \"UInt64\" || name === \"Float64\") {\n        return \"float\";\n    }\n\n    if (name === \"String\") {\n        return \"string\";\n    }\n\n    if (name === \"DateTime\") {\n        return \"datetime\";\n    }\n\n    if (name === \"Date\") {\n        return \"date\";\n    }\n\n    throw new Error(`Unknown type '${name}'`);\n}\n\nfunction convertDecimalToNumber(value: any, dtypeString: string) {\n    if (!(value instanceof Uint32Array || value instanceof Int32Array)) {\n        return value;\n    }\n\n    let bigIntValue = BigInt(0);\n    for (let i = 0; i < value.length; i++) {\n        bigIntValue |= BigInt(value[i]) << BigInt(i * 32);\n    }\n\n    const scaleMatch = dtypeString.match(/Decimal\\[\\d+e(\\d+)\\]/);\n    if (scaleMatch) {\n        const scale = parseInt(scaleMatch[1]);\n        return Number(bigIntValue) / Math.pow(10, scale);\n    } else {\n        return Number(bigIntValue);","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-js/src/ts/virtual_servers/clickhouse.ts#L141-L177","documentation":"`duckdbTypeToPsp()` in the ClickHouse virtual-server adapter maps ClickHouse/duckdb type names to Perspective type strings (`string`, `date`, etc.). When it encounters a type `name` it has no mapping for, it throws \"Unknown type '<name>'\". Callers `tableSchema`, `tableValidateExpression`, and `dtype` hit this whenever a remote table's schema contains a type the adapter does not recognize.","triggerScenarios":"A ClickHouse table includes a column type not in the adapter's mapping — e.g. `UUID`, `Array(...)`, `Tuple(...)`, `Map(...)`, `Enum8/Enum16`, `Nullable(...)` wrapping an unmapped base, `IPv4/IPv6`, `FixedString`, or an unusually cased name like `date` vs `Date` (mapping is case-sensitive: `Date` matches, `DATE` does not).","commonSituations":"Schemas created with newer ClickHouse types than the adapter version supports; columns using composite/parameterized types (Array, Tuple, Nullable) that the flat mapping can't express; case-mismatched type names from a driver or middleware normalizing types differently.","solutions":["Upgrade perspective / the ClickHouse adapter to a version whose `duckdbTypeToPsp` mapping includes the offending type.","Change the column type on the ClickHouse side (e.g. cast `Nullable(X)` to `X`, or cast exotic types to String) before registering the table.","Cast unmapped columns to a supported type in your query (e.g. `CAST(col AS String)`) when defining the table.","If the type is broadly a known one, patch the mapping function to add the `name` → psp-type case (check exact casing)."],"exampleFix":"// before\nSELECT id, tags FROM events -- tags is Array(String): Unknown type 'Array(String)'\n// after\nSELECT id, CAST(tags AS String) AS tags FROM events","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\"String\", \"Int8\", \"Int16\", \"Int32\", \"Int64\", \"UInt8\", \"UInt16\", \"UInt32\", \"UInt64\", \"Float32\", \"Float64\", \"Bool\", \"Date\", \"DateTime\"]);\nfor (const col of schema) {\n  if (!SUPPORTED.has(col.type)) console.warn(`Unmapped ClickHouse type '${col.type}' for column ${col.name}; cast or upgrade adapter.`);\n}","typeGuard":"function isSupportedClickHouseType(t: string): boolean {\n  return /^(String|Bool|Date|DateTime|Float\\d\\d?|U?Int\\d+)$/.test(t);\n}","tryCatchPattern":"try {\n  const schema = await tableSchema(table);\n} catch (e) {\n  const m = String(e.message).match(/Unknown type '(.+)'/);\n  if (m) {\n    console.error(`ClickHouse type ${m[1]} not supported; cast the column to a base type.`);\n  }\n  throw e;\n}","preventionTips":["Cast Nullable/composite columns (Array, Tuple, Map, Enum) to base types in your source query.","Keep perspective and its ClickHouse adapter up to date with your ClickHouse server version.","Watch for case-sensitive type names (`Date`, not `DATE`).","Validate remote table schemas against the supported-type list before registering tables."],"tags":["clickhouse","type-mapping","schema","unsupported-type"],"backgroundTag":"unsupported-dtype","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"}