risingwavelabs/risingwave · error
mysql_query function is not supported in streaming mode
Error message
mysql_query function is not supported in streaming mode
What it means
LogicalMySqlQuery represents a query executed via the mysql_query table function, which can only be evaluated in batch mode by pushing the query to the external MySQL source. Streaming execution (materialized views, sources) cannot continuously evaluate such a query, so to_stream deliberately returns an error.
Solutions
- Do not use mysql_query in materialized views or any streaming query; keep it in ad-hoc batch SELECT statements
- Use RisingWave's MySQL CDC connector to ingest the table as a streaming source instead of querying per-request
- Batch-query the data first and persist results to a table/MV via an ingestion pipeline that supports streaming
- If periodic refresh is acceptable, schedule batch inserts into a table rather than an MV over mysql_query
Example fix
-- before (fails)
CREATE MATERIALIZED VIEW mv AS SELECT * FROM mysql_query('conn_name', 'SELECT * FROM t');
-- after: batch query only, or use CDC source
SELECT * FROM mysql_query('conn_name', 'SELECT * FROM t');
-- streaming alternative: MySQL CDC source + materialized view over the source Defensive patterns
Strategy: validation
Validate before calling
-- Pre-check that a definition does not use mysql_query before making it streaming -- inspect the SQL for the function, e.g. in application code: -- if /\bmysql_query\s*\(/i.test(sql) rejectStreamingDefinition();
Try / catch
// psql/driver catch
try {
await conn.query('CREATE MATERIALIZED VIEW mv AS SELECT * FROM mysql_query(...)');
} catch (e) {
if (String(e.message).includes('mysql_query function is not supported in streaming mode')) {
// fall back to batch query or set up a CDC source
}
throw e;
} Prevention
- Never use mysql_query in CREATE MATERIALIZED VIEW / INDEX or other streaming DDL
- Use MySQL CDC connectors for streaming ingestion from MySQL
- Reserve mysql_query for ad-hoc batch SELECTs
- Review team SQL templates for external query functions before streaming jobs
When it happens
Trigger: Creating a materialized view, source, or any streaming plan that contains a mysql_query(...) table function call, causing the stream optimizer to call to_stream on LogicalMySqlQuery.
Common situations: A user runs CREATE MATERIALIZED VIEW AS SELECT * FROM mysql_query(...) expecting live replication of an external MySQL query; envs where teams assume mysql_query can act as a streaming source.
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
- postgres_query function is not supported in streaming mode
- Actor exited unexpectedly
- Array error
- below watermark check condition eval must return bool array
- Chunk operation error
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/ecb6092f20ebc599.
Report an issue: GitHub.
Appendix: source
Thrown at src/frontend/src/optimizer/plan_node/logical_mysql_query.rs:107
fn predicate_pushdown(
&self,
predicate: Condition,
_ctx: &mut PredicatePushdownContext,
) -> LogicalPlanRef {
// No pushdown.
LogicalFilter::create(self.clone().into(), predicate)
}
}
impl ToBatch for LogicalMySqlQuery {
fn to_batch(&self) -> Result<BatchPlanRef> {
Ok(BatchMySqlQuery::new(self.core.clone()).into())
}
}
impl ToStream for LogicalMySqlQuery {
fn to_stream(&self, _ctx: &mut ToStreamContext) -> Result<StreamPlanRef> {
bail!("mysql_query function is not supported in streaming mode")
}
fn logical_rewrite_for_stream(
&self,
_ctx: &mut RewriteStreamContext,
) -> Result<(PlanRef, ColIndexMapping)> {
bail!("mysql_query function is not supported in streaming mode")
}
}
View on GitHub (pinned to 6469eb736d)