risingwavelabs/risingwave · error · SinkError::Config

Dont support auto create table for datatype

Error message

Dont support auto create table for datatype: {}

What it means

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.

Solutions

  1. Remove or cast the unsupported column to a mapped primitive type (e.g. CAST struct/list columns to VARCHAR/JSONB->VARCHAR) before the sink
  2. Disable auto table creation and create the Snowflake target table manually with a compatible schema
  3. 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

Example fix

// before
CREATE SINK s INTO snowflake ... ; -- column 'payload' is STRUCT
// after
CREATE SINK s INTO snowflake ... AS SELECT CAST(payload AS VARCHAR) AS payload FROM ...;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[&str] = &["BOOLEAN","INT16","INT32","INT64","FLOAT32","FLOAT64","VARCHAR","DECIMAL","BYTEA","TIME","DATE","TIMESTAMP","TIMESTAMPTZ"];
fn check_snowflake_auto_create_ok(cols: &[DataType]) -> Result<(), String> {
    let bad: Vec<_> = cols.iter().filter(|d| !SUPPORTED.contains(&d.to_string().as_str())).collect();
    if bad.is_empty() { Ok(()) } else { Err(format!("unsupported for snowflake auto-create: {:?}", bad)) }
}

Try / catch

match create_sink_with_auto_table(props) {
    Err(e) if e.to_string().contains("Dont support auto create table") => precreate_table_manually(),
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/77f7c3453e319c4d. Report an issue: GitHub.

Appendix: source

Thrown at src/connector/src/sink/snowflake_redshift/snowflake.rs:1043

        DataType::Int32 => "INTEGER".to_owned(),
        DataType::Int64 => "BIGINT".to_owned(),
        DataType::Float32 => "FLOAT4".to_owned(),
        DataType::Float64 => "FLOAT8".to_owned(),
        DataType::Boolean => "BOOLEAN".to_owned(),
        DataType::Varchar => "STRING".to_owned(),
        DataType::Date => "DATE".to_owned(),
        DataType::Timestamp => "TIMESTAMP".to_owned(),
        DataType::Timestamptz => "TIMESTAMP_TZ".to_owned(),
        DataType::Jsonb => "STRING".to_owned(),
        // RisingWave uses rust_decimal with MAX_PRECISION=28. Snowflake's DECIMAL without
        // explicit precision defaults to (38,0), which drops all fractional digits. We use
        // DECIMAL(38, 10) to preserve up to 10 fractional digits, matching the Iceberg sink
        // convention, though values with more than 10 fractional digits may still lose precision.
        DataType::Decimal => "DECIMAL(38, 10)".to_owned(),
        DataType::Bytea => "BINARY".to_owned(),
        DataType::Time => "TIME".to_owned(),
        _ => {
            return Err(SinkError::Config(anyhow!(
                "Dont support auto create table for datatype: {}",
                data_type
            )));
        }
    };
    Ok(data_type)
}

fn build_create_pipe_sql(
    table_name: &str,
    database: &str,
    schema: &str,
    stage: &str,
    pipe_name: &str,
    target_table_name: &str,
) -> String {
    let pipe_name = format!(r#""{}"."{}"."{}""#, database, schema, pipe_name);
    let copy_into_sql = build_copy_into_sql(table_name, database, schema, stage, target_table_name);

View on GitHub (pinned to 6469eb736d)