databendlabs/databend · error
replace with streaming not supported yet
Error message
replace with streaming not supported yet
What it means
The REPLACE interpreter does not support streaming-load input sources at all. If a REPLACE statement's input is InsertInputSource::StreamingLoad (the MySQL-style streaming insert channel), the code hits unreachable! and panics, because REPLACE requires a fully formed query or stage source instead of an inline stream.
Solutions
- Rewrite the statement to REPLACE INTO ... SELECT ... from an existing table instead of streaming rows.
- First INSERT-stream the rows into a staging table, then run REPLACE INTO target SELECT * FROM staging.
- Use a driver/statement form that produces a query-based source for REPLACE.
Defensive patterns
Strategy: validation
Validate before calling
-- Rewrite streaming REPLACE into table-then-merge: INSERT INTO staging_table VALUES (...); REPLACE INTO target SELECT * FROM staging_table;
Prevention
- Never issue REPLACE through a driver's streaming write channel
- Document that REPLACE requires a query or stage source
- Wrap streaming ingestion in an intermediate table
When it happens
Trigger: Issuing a REPLACE statement whose input plan comes through the streaming-load path (e.g. REPLACE INTO combined with a streaming write), rather than a SELECT/query or stage COPY source.
Common situations: Client drivers or connectors that stream row data inline attempting REPLACE; tools that generalize INSERT streaming logic to REPLACE statements.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Input plan must be Query, but it's
- internal error: entered unreachable code
- create_procedure: CreateOrReplace should never conflict…
- plan in InsertInputSource::Stag must be CopyIntoTable
- Input plan must be Query, but it's
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/33a38375833486f2.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/service/src/interpreters/interpreter_replace.rs:451
copy_plan.stage_table_info.files_to_copy.unwrap_or_default(),
copy_plan.stage_table_info.stage_info.clone(),
copy_plan.stage_table_info.copy_into_table_options.clone(),
));
Ok(ReplaceSourceCtx {
root: physical_plan,
select_ctx: None,
update_stream_meta: vec![],
bind_context: None,
})
}
_ => unreachable!("plan in InsertInputSource::Stag must be CopyIntoTable"),
},
#[cfg(not(feature = "storage-stage"))]
InsertInputSource::Stage(_) => Err(ErrorCode::Unimplemented(
"Stage COPY source support is disabled, rebuild with cargo feature 'storage-stage'",
)),
InsertInputSource::StreamingLoad { .. } => {
unreachable!("replace with streaming not supported yet")
}
}
}
fn connect_value_source(
&self,
schema: DataSchemaRef,
source: &InsertValue,
) -> Result<PhysicalPlan> {
Ok(PhysicalPlan::new(ReplaceAsyncSourcer {
schema,
source: source.clone(),
meta: PhysicalPlanMeta::new("ReplaceAsyncSourcer"),
}))
}
#[async_backtrace::framed]
async fn connect_query_plan_source<'a>(View on GitHub (pinned to 288d84d76e)