diff --git a/src/frontend/planner_test/tests/testdata/subquery.yaml b/src/frontend/planner_test/tests/testdata/subquery.yaml index 3401e8503ce51..6b66130ad691c 100644 --- a/src/frontend/planner_test/tests/testdata/subquery.yaml +++ b/src/frontend/planner_test/tests/testdata/subquery.yaml @@ -353,3 +353,6 @@ Not supported: streaming nested-loop join HINT: The non-equal join in the query requires a nested-loop join executor, which could be very expensive to run. Consider rewriting the query to use dynamic filter as a substitute if possible. See also: https://github.com/risingwavelabs/rfcs/blob/main/rfcs/0033-dynamic-filter.md +- sql: | + SELECT 1, (SELECT regexp_matches('barbeque barbeque', '(bar)(beque)', 'g')) + batch_error: 'internal error: Scalar subquery might produce more than one row.' diff --git a/src/frontend/src/optimizer/plan_visitor/max_one_row_visitor.rs b/src/frontend/src/optimizer/plan_visitor/max_one_row_visitor.rs index 4851cb302fde1..54bdfeefbdd27 100644 --- a/src/frontend/src/optimizer/plan_visitor/max_one_row_visitor.rs +++ b/src/frontend/src/optimizer/plan_visitor/max_one_row_visitor.rs @@ -16,8 +16,8 @@ use std::collections::HashSet; use crate::optimizer::plan_node::{ LogicalAgg, LogicalApply, LogicalExpand, LogicalFilter, LogicalHopWindow, LogicalLimit, - LogicalNow, LogicalProject, LogicalProjectSet, LogicalTopN, LogicalUnion, LogicalValues, - PlanTreeNodeBinary, PlanTreeNodeUnary, + LogicalNow, LogicalProject, LogicalProjectSet, LogicalScan, LogicalTopN, LogicalUnion, + LogicalValues, PlanTreeNodeBinary, PlanTreeNodeUnary, }; use crate::optimizer::plan_visitor::PlanVisitor; use crate::optimizer::PlanTreeNode; @@ -77,8 +77,12 @@ impl PlanVisitor for MaxOneRowVisitor { plan.column_subsets().len() == 1 && self.visit(plan.input()) } - fn visit_logical_project_set(&mut self, plan: &LogicalProjectSet) -> bool { - plan.select_list().len() == 1 && self.visit(plan.input()) + fn visit_logical_project_set(&mut self, _plan: &LogicalProjectSet) -> bool { + false + } + + fn visit_logical_scan(&mut self, _plan: &LogicalScan) -> bool { + false } fn visit_logical_hop_window(&mut self, _plan: &LogicalHopWindow) -> bool {