diff --git a/src/common/recordbatch/src/adapter.rs b/src/common/recordbatch/src/adapter.rs index 85236381b2..98f4d0a38a 100644 --- a/src/common/recordbatch/src/adapter.rs +++ b/src/common/recordbatch/src/adapter.rs @@ -329,6 +329,7 @@ impl ExecutionPlanVisitor for MetricCollector { level: self.current_level, metrics: vec![], }); + self.current_level += 1; return Ok(true); }; @@ -365,8 +366,7 @@ impl ExecutionPlanVisitor for MetricCollector { } fn post_visit(&mut self, _plan: &dyn ExecutionPlan) -> std::result::Result { - // the last minus will underflow - self.current_level = self.current_level.wrapping_sub(1); + self.current_level -= 1; Ok(true) } } diff --git a/tests/cases/standalone/common/select/union_all.result b/tests/cases/standalone/common/select/union_all.result new file mode 100644 index 0000000000..54332e1254 --- /dev/null +++ b/tests/cases/standalone/common/select/union_all.result @@ -0,0 +1,10 @@ +SELECT 123 as a, 'h' as b UNION ALL SELECT 456 as a, 'e' as b UNION ALL SELECT 789 as a, 'l' as b order by a; + ++-----+---+ +| a | b | ++-----+---+ +| 123 | h | +| 456 | e | +| 789 | l | ++-----+---+ + diff --git a/tests/cases/standalone/common/select/union_all.sql b/tests/cases/standalone/common/select/union_all.sql new file mode 100644 index 0000000000..207d8463fc --- /dev/null +++ b/tests/cases/standalone/common/select/union_all.sql @@ -0,0 +1 @@ +SELECT 123 as a, 'h' as b UNION ALL SELECT 456 as a, 'e' as b UNION ALL SELECT 789 as a, 'l' as b order by a;