risingwavelabs/risingwave · error · SinkError::Iceberg

Current iceberg schema does not match either original_schema

Error message

Current iceberg schema does not match either original_schema ({} cols) or changed schema; cannot determine whether schema change is applied

What it means

check_schema_change_applied compares the current Iceberg table schema against both the pre-change (original_schema) and post-change (expected) column lists to decide if a schema change was already applied. If the current schema matches neither, the function cannot classify the state and fails hard instead of guessing. This prevents wrongly skipping or re-applying a DDL change.

Source

Thrown at src/connector/src/sink/iceberg/commit.rs:919

                .collect_vec(),
            _ => {
                return Err(SinkError::Iceberg(anyhow!(
                    "Unsupported sink schema change op in iceberg sink: {:?}",
                    schema_change.op
                )));
            }
        };

        // If current schema equals the changed schema, then schema change is applied.
        if schema_matches(&expected_after_change) {
            tracing::debug!(
                "Current iceberg schema matches changed schema ({} columns); schema change already applied",
                expected_after_change.len()
            );
            return Ok(true);
        }

        Err(SinkError::Iceberg(anyhow!(
            "Current iceberg schema does not match either original_schema ({} cols) or changed schema; cannot determine whether schema change is applied",
            schema_change.original_schema.len()
        )))
    }

    /// Commit schema changes (e.g., add columns) to the iceberg table.
    /// This function uses Transaction API to atomically update the table schema
    /// with optimistic locking to prevent concurrent conflicts.
    async fn commit_schema_change_impl(&mut self, schema_change: PbSinkSchemaChange) -> Result<()> {
        // Step 1: Build new fields to add
        let iceberg_create_table_arrow_convert = IcebergCreateTableArrowConvert::default();
        let mut new_fields = Vec::new();

        let mut drop_column_names = Vec::new();
        match schema_change.op.as_ref() {
            Some(risingwave_pb::stream_plan::sink_schema_change::Op::AddColumns(
                add_columns_op,
            )) => {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Inspect the Iceberg table's current schema and reconcile it with the intended original/changed schemas (apply or revert the manual change).
  2. Recreate or refresh the sink so its recorded original_schema matches reality, then re-run the schema change.
  3. Avoid external schema edits on Iceberg tables managed by RisingWave sinks; route all schema changes through the upstream table.
  4. Enable/verify schema evolution support and apply changes in order.
Defensive patterns

Strategy: validation

Validate before calling

// Compare current table schema columns against both expected schemas before relying on auto-detection:
let cols: Vec<String> = table.metadata().current_schema().fields().iter().map(|f| f.name.clone()).collect();
assert!(cols == original_cols || cols == changed_cols, "iceberg schema diverged from sink's recorded schemas");

Prevention

When it happens

Trigger: The Iceberg table schema was modified by a third party in a way that diverges from both recorded schemas (extra/renamed/removed columns); the sink's recorded original_schema is stale relative to the actual table; concurrent schema changes interleaved with this check.

Common situations: Manual ALTER TABLE on the Iceberg table by another engine; sink rebuilt with outdated schema history; multiple schema changes applied out of order across sink restarts.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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