{"record":{"id":"77f7c3453e319c4d","repo":"risingwavelabs/risingwave","slug":"dont-support-auto-create-table-for-datatype-77f7c3","errorCode":null,"errorMessage":"Dont support auto create table for datatype: {}","messagePattern":"Dont support auto create table for datatype: (.+?)","errorType":"validation","errorClass":"SinkError::Config","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/snowflake_redshift/snowflake.rs","lineNumber":1043,"sourceCode":"        DataType::Int32 => \"INTEGER\".to_owned(),\n        DataType::Int64 => \"BIGINT\".to_owned(),\n        DataType::Float32 => \"FLOAT4\".to_owned(),\n        DataType::Float64 => \"FLOAT8\".to_owned(),\n        DataType::Boolean => \"BOOLEAN\".to_owned(),\n        DataType::Varchar => \"STRING\".to_owned(),\n        DataType::Date => \"DATE\".to_owned(),\n        DataType::Timestamp => \"TIMESTAMP\".to_owned(),\n        DataType::Timestamptz => \"TIMESTAMP_TZ\".to_owned(),\n        DataType::Jsonb => \"STRING\".to_owned(),\n        // RisingWave uses rust_decimal with MAX_PRECISION=28. Snowflake's DECIMAL without\n        // explicit precision defaults to (38,0), which drops all fractional digits. We use\n        // DECIMAL(38, 10) to preserve up to 10 fractional digits, matching the Iceberg sink\n        // convention, though values with more than 10 fractional digits may still lose precision.\n        DataType::Decimal => \"DECIMAL(38, 10)\".to_owned(),\n        DataType::Bytea => \"BINARY\".to_owned(),\n        DataType::Time => \"TIME\".to_owned(),\n        _ => {\n            return Err(SinkError::Config(anyhow!(\n                \"Dont support auto create table for datatype: {}\",\n                data_type\n            )));\n        }\n    };\n    Ok(data_type)\n}\n\nfn build_create_pipe_sql(\n    table_name: &str,\n    database: &str,\n    schema: &str,\n    stage: &str,\n    pipe_name: &str,\n    target_table_name: &str,\n) -> String {\n    let pipe_name = format!(r#\"\"{}\".\"{}\".\"{}\"\"#, database, schema, pipe_name);\n    let copy_into_sql = build_copy_into_sql(table_name, database, schema, stage, target_table_name);","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/snowflake_redshift/snowflake.rs#L1025-L1061","documentation":"When the Snowflake sink builds an auto-created downstream table, it maps each RisingWave DataType to a Snowflake column type. Types without a mapping (anything falling into the catch-all arm at snowflake.rs:1043) make the sink fail fast with SinkError::Config rather than silently producing a wrong schema.","triggerScenarios":"Creating a Snowflake sink with auto table creation where the source schema contains an unmapped data type such as JSONB, Struct, List/Array, Map, Interval, or other non-primitive types.","commonSituations":"Sinking a table/materialized view with struct or array columns (e.g. from a JSON source or Protobuf/Avro schema) into Snowflake with create_table_if_not_s_exists / auto schema creation enabled; schema evolution added a new RW type after the sink was created.","solutions":["Remove or cast the unsupported column to a mapped primitive type (e.g. CAST struct/list columns to VARCHAR/JSONB->VARCHAR) before the sink","Disable auto table creation and create the Snowflake target table manually with a compatible schema","Check the match list in snowflake.rs (rw_to_snowflake_type) to see which types are supported and extend it if you own the code"],"exampleFix":"// before\nCREATE SINK s INTO snowflake ... ; -- column 'payload' is STRUCT\n// after\nCREATE SINK s INTO snowflake ... AS SELECT CAST(payload AS VARCHAR) AS payload FROM ...;","handlingStrategy":"validation","validationCode":"const SUPPORTED: &[&str] = &[\"BOOLEAN\",\"INT16\",\"INT32\",\"INT64\",\"FLOAT32\",\"FLOAT64\",\"VARCHAR\",\"DECIMAL\",\"BYTEA\",\"TIME\",\"DATE\",\"TIMESTAMP\",\"TIMESTAMPTZ\"];\nfn check_snowflake_auto_create_ok(cols: &[DataType]) -> Result<(), String> {\n    let bad: Vec<_> = cols.iter().filter(|d| !SUPPORTED.contains(&d.to_string().as_str())).collect();\n    if bad.is_empty() { Ok(()) } else { Err(format!(\"unsupported for snowflake auto-create: {:?}\", bad)) }\n}","typeGuard":null,"tryCatchPattern":"match create_sink_with_auto_table(props) {\n    Err(e) if e.to_string().contains(\"Dont support auto create table\") => precreate_table_manually(),\n    other => other,\n}","preventionTips":["Inspect the sink schema for struct/list/map/jsonb types before enabling auto table creation","Cast complex columns to VARCHAR in the sink query","Pre-create the Snowflake table yourself instead of relying on auto-create"],"tags":["snowflake","sink","schema","unsupported-type"],"backgroundTag":"unsupported-config-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}