risingwavelabs/risingwave · error · SinkError::BigQuery

Don't support Variant

Error message

Don't support Variant

What it means

When building the protobuf schema used to encode rows for the BigQuery Storage Write API, each RisingWave column type is mapped to a protobuf field type. VARIANT has no protobuf mapping in this sink, so building the schema aborts with this error during sink creation.

Source

Thrown at src/connector/src/sink/big_query.rs:1005

        DataType::Timestamp => field.r#type = Some(field_descriptor_proto::Type::String.into()),
        DataType::Timestamptz => field.r#type = Some(field_descriptor_proto::Type::String.into()),
        DataType::Interval => field.r#type = Some(field_descriptor_proto::Type::String.into()),
        DataType::Struct(s) => {
            field.r#type = Some(field_descriptor_proto::Type::Message.into());
            let name = format!("Struct{}", name);
            let sub_proto = build_protobuf_schema(s.iter(), name.clone())?;
            field.type_name = Some(name);
            return Ok((field, Some(sub_proto)));
        }
        DataType::List(l) => {
            let (mut field, proto) = build_protobuf_field(l.elem(), index, name)?;
            field.label = Some(field_descriptor_proto::Label::Repeated.into());
            return Ok((field, proto));
        }
        DataType::Bytea => field.r#type = Some(field_descriptor_proto::Type::Bytes.into()),
        DataType::Jsonb => field.r#type = Some(field_descriptor_proto::Type::String.into()),
        DataType::Variant => {
            return Err(SinkError::BigQuery(anyhow::anyhow!("Don't support Variant")));
        }
        DataType::Serial => field.r#type = Some(field_descriptor_proto::Type::Int64.into()),
        DataType::Float32 | DataType::Int256 => {
            return Err(SinkError::BigQuery(anyhow::anyhow!(
                "Don't support Float32 and Int256"
            )));
        }
        DataType::Map(_) => return Err(SinkError::BigQuery(anyhow::anyhow!("Don't support Map"))),
        DataType::Vector(_) => {
            return Err(SinkError::BigQuery(anyhow::anyhow!("Don't support Vector")));
        }
    }
    Ok((field, None))
}

#[cfg(test)]
mod test {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Cast the VARIANT column to JSONB or VARCHAR in the sink query.
  2. Exclude the VARIANT column via an explicit SELECT column list in `CREATE SINK ... AS SELECT`.
  3. Use a different sink target that supports VARIANT, or file an issue to add VARIANT support to the BigQuery connector.
  4. Validate the sink schema early in dev to catch unsupported types before production.

Example fix

// before
CREATE SINK s FROM mv;  -- mv contains a variant column
// after
CREATE SINK s AS SELECT id, event_data::jsonb AS event_data FROM mv;
Defensive patterns

Strategy: validation

Validate before calling

-- Reject VARIANT columns before CREATE SINK:
-- SELECT count(*) FROM <mv> ... ; or inspect the schema:
-- any column with data_type 'variant' will fail BigQuery sink creation.

Try / catch

match sink_creation {
    Err(SinkError::BigQuery(e)) if e.to_string().contains("Don't support Variant") => {
        // cast the variant column to jsonb/varchar in the sink query and retry
    }
    other => other?,
}

Prevention

When it happens

Trigger: BigQuerySinkWriter::new -> build_protobuf_schema -> build_protobuf_field encounters a column of DataType::Variant in the sink schema.

Common situations: A source/table containing VARIANT columns is connected to a BigQuery sink; a VARIANT column was added to the MV after the sink was planned.

Related errors


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