{"record":{"id":"a1dab69759d77d1d","repo":"risingwavelabs/risingwave","slug":"field-s-type-is-incompatible-risingwave-convert","errorCode":null,"errorMessage":"field {}'s type is incompatible\nRisingWave converted data type: {}\niceberg's data type: {}","messagePattern":"field (.+?)'s type is incompatible\nRisingWave converted data type: (.+?)\niceberg's data type: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/iceberg/create_table.rs","lineNumber":382,"sourceCode":"            Ok(true)\n        }\n        (_, left, right) => Ok(left.equals_datatype(right)),\n    }\n}\n\nfn check_compatibility(\n    schema_fields: HashMap<&str, &risingwave_common::types::DataType>,\n    fields: &ArrowFields,\n) -> anyhow::Result<bool> {\n    for arrow_field in fields {\n        let our_field_type = schema_fields\n            .get(arrow_field.name().as_str())\n            .ok_or_else(|| anyhow!(\"Field {} not found in our schema\", arrow_field.name()))?;\n\n        if !field_is_compatible(our_field_type, arrow_field)? {\n            let converted_arrow_data_type = IcebergArrowConvert\n                .to_arrow_field(\"\", our_field_type)\n                .map_err(|e| anyhow!(e))?\n                .data_type()\n                .clone();\n            bail!(\n                \"field {}'s type is incompatible\\nRisingWave converted data type: {}\\niceberg's data type: {}\",\n                arrow_field.name(),\n                converted_arrow_data_type,\n                arrow_field.data_type()\n            );\n        }\n    }\n    Ok(true)\n}\n\n/// Try to match our schema with iceberg schema.\npub fn try_matches_arrow_schema(rw_schema: &Schema, arrow_schema: &ArrowSchema) -> Result<()> {\n    if rw_schema.fields.len() != arrow_schema.fields().len() {\n        bail!(\n            \"Schema length mismatch, risingwave is {}, and iceberg is {}\",","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/iceberg/create_table.rs#L364-L400","documentation":"When a column exists in both schemas but its types are not compatible, `check_compatibility` bails with a detailed message listing the RisingWave-converted Arrow data type and the Iceberg table's Arrow data type. This is the sink refusing to write into a table whose column type cannot accept RisingWave's data.","triggerScenarios":"Called from `try_matches_arrow_schema`: `field_is_compatible` returns false for a column — e.g., RW INT vs Iceberg STRING, mismatched struct field names/order, mismatched list element types, VARIANT vs non-VARIANT.","commonSituations":"Creating a sink into a pre-existing Iceberg table with different column types; type changed in RisingWave after the Iceberg table was created; nested struct/list type drift; decimal precision differences are tolerated but other type differences are not.","solutions":["Compare the two printed data types in the message and CAST the sink column to match the Iceberg table type.","If you own the table, recreate the Iceberg table with types derived from the RW schema (let RW create the table).","For VARIANT columns, ensure both sides are VARIANT (plain structs won't be accepted).","Ensure nested struct field names and order match exactly, since structs are compared positionally."],"exampleFix":"// before: RW column is INTEGER, Iceberg table column is STRING\nCREATE SINK s AS SELECT id FROM t;\n// after\nCREATE SINK s AS SELECT id::VARCHAR AS id FROM t;","handlingStrategy":"validation","validationCode":"// pre-validate each column type against the table before creating the sink\nfor (name, rw_t, arrow_f) in pairs {\n    if !field_is_compatible(rw_t, arrow_f)? {\n        eprintln!(\"column {name}: RW {:?} vs table {}\", rw_t, arrow_f.data_type());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["CAST sink columns to the table's types in the SELECT list.","Let RisingWave create the Iceberg table so types are derived from one schema.","Watch the message's two printed types to pinpoint the mismatch quickly."],"tags":["iceberg","schema","type-mismatch","compatibility"],"backgroundTag":"type-mismatch","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"}