{"record":{"id":"8aeb9cc1ce87b294","repo":"risingwavelabs/risingwave","slug":"lancedb-sink-does-not-support-schema-change","errorCode":null,"errorMessage":"LanceDB sink does not support schema change","messagePattern":"LanceDB sink does not support schema change","errorType":"exception","errorClass":"SinkError::LanceDb","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/lancedb.rs","lineNumber":721,"sourceCode":"\n#[async_trait::async_trait]\nimpl TwoPhaseCommitCoordinator for LanceDbSinkCommitter {\n    async fn init(&mut self) -> Result<()> {\n        tracing::info!(\n            \"LanceDB commit coordinator initialized for table '{}'\",\n            self.config.common.table\n        );\n        Ok(())\n    }\n\n    async fn pre_commit(\n        &mut self,\n        epoch: u64,\n        metadata: Vec<SinkMetadata>,\n        schema_change: Option<PbSinkSchemaChange>,\n    ) -> Result<Option<Vec<u8>>> {\n        if schema_change.is_some() {\n            return Err(SinkError::LanceDb(anyhow!(\n                \"LanceDB sink does not support schema change\"\n            )));\n        }\n\n        let fragments = Self::collect_fragments(&metadata)?;\n        if fragments.is_empty() {\n            return Ok(None);\n        }\n\n        Ok(Some(\n            LanceDbPreCommitMetadata {\n                sink_id: self.sink_id.clone(),\n                epoch,\n                fragments,\n            }\n            .try_into_bytes()?,\n        ))\n    }","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/lancedb.rs#L703-L739","documentation":"The LanceDB sink's pre_commit explicitly rejects any sink schema change request. RisingWave allows sinks to receive schema-change events, but the LanceDB implementation has not implemented schema evolution, so any non-null schema_change is refused with this error instead of being silently ignored.","triggerScenarios":"pre_commit is invoked with a non-null PbSinkSchemaChange — i.e., the source or materialized table feeding the sink undergoes a schema change (ALTER ADD/DROP COLUMN, type change) while the LanceDB sink is running.","commonSituations":"Developer ALTERs an upstream MV or source column after creating a LanceDB sink; automated schema evolution on a streaming job whose downstream sink is LanceDB.","solutions":["Do not alter the upstream source/MV schema while a LanceDB sink depends on it; drop and recreate the sink after the change","Drop the sink, perform the schema change, then recreate the LanceDB sink so it plans against the new schema","Check whether your RisingWave version has added LanceDB schema-evolution support and upgrade"],"exampleFix":"// before\nALTER TABLE mv ADD COLUMN new_col INT; -- errors: sink does not support schema change\n// after\nDROP SINK lancedb_sink;\nALTER TABLE mv ADD COLUMN new_col INT;\nCREATE SINK lancedb_sink AS SELECT ... INTO lancedb_table ...;","handlingStrategy":"validation","validationCode":"-- before altering an upstream table feeding a LanceDB sink\nSELECT sink_name FROM rw_catalog.rw_sinks\nWHERE sink_from = '<upstream_table>';  -- drop/recreate these sinks first","typeGuard":"fn schema_change_supported(sink_type: &str) -> bool {\n    sink_type != \"lancedb\"\n}","tryCatchPattern":"match alter_result {\n    Err(err) if err.to_string().contains(\"does not support schema change\") => {\n        // drop sink, alter, recreate sink\n    }\n    other => other,\n}","preventionTips":["Plan schema evolution: drop and recreate LanceDB sinks around any ALTER on upstream sources/MVs","Check sink documentation for schema-change support before relying on schema evolution","Keep sink DDL in migration scripts so it is always recreated with the current schema"],"tags":["lancedb","sink","schema-change","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}