risingwavelabs/risingwave · error · SinkError::BigQuery

The length of the RisingWave column {} must be equal to the

Error message

The length of the RisingWave column {} must be equal to the length of the bigquery column {}

What it means

`check_column_name_and_type` requires the RisingWave sink schema and the existing BigQuery table to have the same number of columns. When `rw_fields_name.len() != big_query_columns_desc.len()`, validation fails with this error naming both counts.

Source

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

        if matches!(rw_data_type, DataType::Decimal) {
            return Ok(Self::is_decimal_type_compatible(bigquery_type));
        }

        Ok(Self::get_string_and_check_support_from_datatype(rw_data_type)? == bigquery_type)
    }

    fn check_column_name_and_type(
        &self,
        big_query_columns_desc: HashMap<String, String>,
    ) -> Result<()> {
        let rw_fields_name = self.schema.fields();
        if big_query_columns_desc.is_empty() {
            return Err(SinkError::BigQuery(anyhow::anyhow!(
                "Cannot find table in bigquery"
            )));
        }
        if rw_fields_name.len().ne(&big_query_columns_desc.len()) {
            return Err(SinkError::BigQuery(anyhow::anyhow!(
                "The length of the RisingWave column {} must be equal to the length of the bigquery column {}",
                rw_fields_name.len(),
                big_query_columns_desc.len()
            )));
        }

        for i in rw_fields_name {
            let value = big_query_columns_desc.get(&i.name).ok_or_else(|| {
                SinkError::BigQuery(anyhow::anyhow!(
                    "Column `{:?}` on RisingWave side is not found on BigQuery side.",
                    i.name
                ))
            })?;
            let data_type_string = Self::get_string_and_check_support_from_datatype(&i.data_type)?;
            if !Self::is_data_type_compatible(&i.data_type, value)? {
                return Err(SinkError::BigQuery(anyhow::anyhow!(
                    "Data type mismatch for column `{:?}`. BigQuery side: `{:?}`, RisingWave side: `{:?}`. ",
                    i.name,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Align the schemas: recreate the BigQuery table with exactly the same columns as the RisingWave relation
  2. Or recreate the sink against a materialized view whose columns match the table
  3. Or drop and recreate the sink with a fresh auto-created table
Defensive patterns

Strategy: validation

Validate before calling

bq show --format=json proj:ds.tbl | jq '.schema.fields | length'  # compare with:
SELECT count(*) FROM information_schema.columns WHERE table_name='<mv>';

Try / catch

if rw_len != bq_len {
    return Err(anyhow!("column count differs (rw={} bq={}); align schemas before sinking", rw_len, bq_len));
}

Prevention

When it happens

Trigger: Sink creation (`validate`) where the materialized view has N columns but the pre-existing BigQuery table has M != N columns — e.g. the table has extra columns, or the MV was altered after the table was created.

Common situations: Table created manually with additional GCP-required columns (e.g. load-time partitioning columns); MV schema evolved but the BigQuery table was not recreated; column dropped on one side only.

Related errors


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