{"record":{"id":"a4055655a0a26b04","repo":"risingwavelabs/risingwave","slug":"data-type-mismatch-for-column-bigquery-sid","errorCode":null,"errorMessage":"Data type mismatch for column `{:?}`. BigQuery side: `{:?}`, RisingWave side: `{:?}`. ","messagePattern":"Data type mismatch for column `(.+?)`\\. BigQuery side: `(.+?)`, RisingWave side: `(.+?)`\\. ","errorType":"validation","errorClass":"SinkError::BigQuery","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/big_query.rs","lineNumber":380,"sourceCode":"        }\n        if rw_fields_name.len().ne(&big_query_columns_desc.len()) {\n            return Err(SinkError::BigQuery(anyhow::anyhow!(\n                \"The length of the RisingWave column {} must be equal to the length of the bigquery column {}\",\n                rw_fields_name.len(),\n                big_query_columns_desc.len()\n            )));\n        }\n\n        for i in rw_fields_name {\n            let value = big_query_columns_desc.get(&i.name).ok_or_else(|| {\n                SinkError::BigQuery(anyhow::anyhow!(\n                    \"Column `{:?}` on RisingWave side is not found on BigQuery side.\",\n                    i.name\n                ))\n            })?;\n            let data_type_string = Self::get_string_and_check_support_from_datatype(&i.data_type)?;\n            if !Self::is_data_type_compatible(&i.data_type, value)? {\n                return Err(SinkError::BigQuery(anyhow::anyhow!(\n                    \"Data type mismatch for column `{:?}`. BigQuery side: `{:?}`, RisingWave side: `{:?}`. \",\n                    i.name,\n                    value,\n                    data_type_string\n                )));\n            };\n        }\n        Ok(())\n    }\n\n    fn get_string_and_check_support_from_datatype(rw_data_type: &DataType) -> Result<String> {\n        match rw_data_type {\n            DataType::Boolean => Ok(\"BOOL\".to_owned()),\n            DataType::Int16 => Ok(\"INT64\".to_owned()),\n            DataType::Int32 => Ok(\"INT64\".to_owned()),\n            DataType::Int64 => Ok(\"INT64\".to_owned()),\n            DataType::Float32 => Err(SinkError::BigQuery(anyhow::anyhow!(\n                \"REAL is not supported for BigQuery sink. Please convert to FLOAT64 or other supported types.\"","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/big_query.rs#L362-L398","documentation":"For each matched column, `is_data_type_compatible` compares the BigQuery column's actual type against the type string that the connector would write for the RisingWave field (e.g. NUMERIC vs FLOAT64). A mismatch means the sink could write values BigQuery would reject or corrupt, so validation fails naming both types.","triggerScenarios":"Sink creation where a column exists on both sides but with incompatible types — e.g. RW INTEGER column against a BigQuery FLOAT64 column, RW VARCHAR against BYTES, or RW DECIMAL against a parameterized NUMERIC the compat check rejects.","commonSituations":"Table created manually with different types than RW would choose; NUMERIC/BIGNUMERIC parameterization differences; schema drift after MV evolution.","solutions":["Alter/recreate the BigQuery table so each column's type equals the mapping produced by `get_string_and_check_support_from_datatype` (INT64, FLOAT64, NUMERIC, DATE, STRING, BYTES, JSON, ARRAY<...>)","Or cast the column in the sink's MV to a type compatible with the table","Recreate the sink to re-run validation"],"exampleFix":"-- BQ table column is FLOAT64 but RW side is DECIMAL\n-- after: recreate BQ table column as NUMERIC, or\nCREATE MATERIALIZED VIEW mv AS SELECT CAST(x AS DOUBLE PRECISION) AS x ...;","handlingStrategy":"validation","validationCode":"const typeMap = { Int16: \"INT64\", Int32: \"INT64\", Int64: \"INT64\", Float64: \"FLOAT64\", Decimal: \"NUMERIC\", Date: \"DATE\", Varchar: \"STRING\", Bytea: \"BYTES\", Jsonb: \"JSON\" };\nfor (const f of rwFields) {\n  const bqType = bqCols.get(f.name);\n  if (typeMap[f.dataType] && bqType !== typeMap[f.dataType]) throw new Error(`type mismatch on ${f.name}: bq=${bqType} rw=${typeMap[f.dataType]}`);\n}","typeGuard":null,"tryCatchPattern":"if !is_compatible(rw_type, bq_type) {\n    return Err(anyhow!(\"recreate table column {} as {}\", name, expected_string));\n}","preventionTips":["Let RisingWave create the table so types are chosen consistently","Compare bq show schema output against the RW mapping table before validating","Cast mismatched columns in the MV"],"tags":["bigquery","schema","type-mismatch"],"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"}