risingwavelabs/risingwave · error
BatchMatchRecognize is not implemented yet
Error message
BatchMatchRecognize is not implemented yet
What it means
`LogicalMatchRecognize::to_batch` deliberately bails with `ErrorCode::NotSupported`: the `MATCH_RECOGNIZE` clause has no batch (query-time, non-materialized) execution path. It is only implemented for streaming plans (via `StreamMatchRecognize`), so any attempt to plan `MATCH_RECOGNIZE` as a batch query fails here.
Source
Thrown at src/frontend/src/optimizer/plan_node/logical_match_recognize.rs:195
self.core.visit_exprs(v);
}
}
impl PredicatePushdown for LogicalMatchRecognize {
fn predicate_pushdown(
&self,
predicate: Condition,
ctx: &mut PredicatePushdownContext,
) -> PlanRef {
// Output columns are computed (partition/measures), so do not push predicates through, but
// keep recursing so a share below this node receives a contribution from every parent.
gen_filter_and_pushdown(self, predicate, Condition::true_cond(), ctx)
}
}
impl ToBatch for LogicalMatchRecognize {
fn to_batch(&self) -> Result<super::BatchPlanRef> {
bail!("BatchMatchRecognize is not implemented yet")
}
}
impl ToStream for LogicalMatchRecognize {
fn to_stream(&self, ctx: &mut ToStreamContext) -> Result<super::StreamPlanRef> {
use super::{StreamEowcSort, StreamFilter, StreamMatchRecognize};
use crate::error::ErrorCode;
use crate::expr::{ExprType, FunctionCall, InputRef};
use crate::optimizer::property::RequiredDist;
use crate::utils::Condition;
// v1 restrictions: PARTITION BY / ORDER BY must be plain columns, PARTITION BY non-empty.
// `NotSupported(cause, hint)` throughout, matching this feature's binder-side validation.
if self.core.partition_key_indices().is_none() || self.core.order_key_indices().is_none() {
return Err(ErrorCode::NotSupported(
"MATCH_RECOGNIZE with an expression in PARTITION BY or ORDER BY".to_owned(),
"use plain column references; compute the expression in a view below and \
partition/order by the resulting column"
.to_owned(),View on GitHub (pinned to 6469eb736d)
Solutions
- Wrap the MATCH_RECOGNIZE query in `CREATE MATERIALIZED VIEW ... AS SELECT ... MATCH_RECOGNIZE ...` so it is planned for streaming instead of batch.
- Query the created materialized view afterwards for the matched rows.
- If batch execution is genuinely needed, implement a `BatchMatchRecognize` plan node or wait for upstream support; track the feature request.
Example fix
// before: batch query fails SELECT * FROM ticker MATCH_RECOGNIZE (PARTITION BY symbol ORDER BY ts ...) ; // after: plan it as a stream CREATE MATERIALIZED VIEW matches AS SELECT * FROM ticker MATCH_RECOGNIZE (PARTITION BY symbol ORDER BY ts ...); SELECT * FROM matches;
Defensive patterns
Strategy: validation
Validate before calling
-- guard: MATCH_RECOGNIZE only works in a streaming (materialized view) context -- avoid running it as an ad-hoc batch SELECT
Try / catch
match client.query("SELECT * FROM t MATCH_RECOGNIZE (...)") {
Err(e) if e.to_string().contains("BatchMatchRecognize is not implemented") => {
eprintln!("Create a materialized view with MATCH_RECOGNIZE instead of a batch query");
}
r => r?,
} Prevention
- Always wrap MATCH_RECOGNIZE in CREATE MATERIALIZED VIEW; never run it as a one-off batch query.
- Check RisingWave release notes for batch MATCH_RECOGNIZE support before using it in ad-hoc SQL.
- Document this streaming-only limitation in team SQL style guides.
When it happens
Trigger: Running a `SELECT ... MATCH_RECOGNIZE ...` statement as a batch/ad-hoc query (not inside a `CREATE MATERIALIZED VIEW`), or any batch planning path (`to_batch`) that encounters a `LogicalMatchRecognize` node.
Common situations: Users try the standard SQL pattern `SELECT * FROM t MATCH_RECOGNIZE (...)` directly in psql; in RisingWave it only works when creating a materialized view or in a streaming context.
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
- MATCH_RECOGNIZE requires an ORDER BY clause
- physical NEXT in a MATCH_RECOGNIZE DEFINE is not supported
- MATCH_RECOGNIZE only supports the default ascending ORDER BY
- AFTER MATCH SKIP TO FIRST/LAST missing its target variable
- query_epoch not set in distributed lookup join
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/dd350c4cca61c572.
Report an issue: GitHub.