{"record":{"id":"fbb13b1b6162a79b","repo":"risingwavelabs/risingwave","slug":"unsupported-cast-0-to-1","errorCode":null,"errorMessage":"Unsupported cast: {0} to {1}","messagePattern":"Unsupported cast: (.+?) to (.+?)","errorType":"exception","errorClass":"ExprError","httpStatus":null,"severity":"error","filePath":"src/expr/core/src/error.rs","lineNumber":52,"sourceCode":"impl From<ContextUnavailable> for ExprError {\n    fn from(e: ContextUnavailable) -> Self {\n        ExprError::Context(e.0)\n    }\n}\n\n/// The error type for expression operations.\n#[derive(Error, ReportDebug)]\npub enum ExprError {\n    /// A collection of multiple errors in batch evaluation.\n    #[error(\"multiple errors:\\n{1}\")]\n    Multiple(ArrayRef, MultiExprError),\n\n    // Ideally \"Unsupported\" errors are caught by frontend. But when the match arms between\n    // frontend and backend are inconsistent, we do not panic with `unreachable!`.\n    #[error(\"Unsupported function: {0}\")]\n    UnsupportedFunction(String),\n\n    #[error(\"Unsupported cast: {0} to {1}\")]\n    UnsupportedCast(DataType, DataType),\n\n    #[error(\"Casting to {0} out of range\")]\n    CastOutOfRange(&'static str),\n\n    #[error(\"Numeric out of range\")]\n    NumericOutOfRange,\n\n    #[error(\"Numeric out of range: underflow\")]\n    NumericUnderflow,\n\n    #[error(\"Numeric out of range: overflow\")]\n    NumericOverflow,\n\n    #[error(\"Division by zero\")]\n    DivisionByZero,\n\n    #[error(\"Parse error: {0}\")]","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/error.rs#L34-L70","documentation":"ExprError::UnsupportedCast is thrown by the cast expression builder when there is no registered cast implementation between the two given DataTypes. Normally the frontend should reject such casts during binding; this surfaces when frontend/backend cast tables disagree or SQL forces an illegal cast.","triggerScenarios":"Building a CastExpression whose from/to DataType pair has no entry in the backend's cast implementation table (e.g. struct -> timestamp).","commonSituations":"Version skew between frontend and compute nodes; SQL with implicit/explicit casts the backend has not implemented; custom types in extensions.","solutions":["Adjust the SQL to cast via an intermediate type (e.g. ::varchar then target)","Upgrade all nodes to the same RisingWave version","Check the cast support matrix in RisingWave docs","Implement/enable the missing cast arm if you're extending the engine"],"exampleFix":"// before\nSELECT ts_col::int FROM t; -- unsupported direct cast\n// after\nSELECT extract(epoch from ts_col)::int FROM t;","handlingStrategy":"try-catch","validationCode":"// check cast support before issuing the cast\n// consult risingwave cast matrix; e.g. avoid direct struct->timestamp casts","typeGuard":null,"tryCatchPattern":"match query_result {\n    Err(e) if e.to_string().starts_with(\"Unsupported cast:\") => {\n        // rewrite with intermediate cast e.g. ::varchar\n    }\n    r => r,\n}","preventionTips":["Cast via varchar as an intermediate for exotic type pairs","Check the cast support table before writing schema-migration SQL","Keep frontend/backend versions aligned"],"tags":["cast","type-system","rust","expression"],"backgroundTag":"unsupported-operation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}