From a676d800fbb7fdab8967bc44baebed1e1d78e0d6 Mon Sep 17 00:00:00 2001 From: discord9 Date: Thu, 5 Nov 2026 14:37:11 +0800 Subject: [PATCH] refactor(query): drop the in-process encodability exception A split aggregate encodes now, so the analyzer no longer needs a special case that skipped the encoding gate for it. The gate itself stays: every plan a region receives still has to encode. Signed-off-by: discord9 --- src/query/src/dist_plan/analyzer.rs | 8 +------- src/query/src/dist_plan/analyzer/test.rs | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/query/src/dist_plan/analyzer.rs b/src/query/src/dist_plan/analyzer.rs index c85d93b30d1..e641579e12d 100644 --- a/src/query/src/dist_plan/analyzer.rs +++ b/src/query/src/dist_plan/analyzer.rs @@ -448,9 +448,6 @@ enum RewriterStatus { struct PlanRewriter { /// Whether the whole plan encodes, allowing per-node checks to be skipped. whole_plan_encodable: bool, - /// In-process root shapes can contain the `Final` half of a split aggregate, which folds every - /// partition's state and so is kept above the region boundary by the commutativity check. - skip_in_process_encodability: bool, /// Whether an in-process root fused plan was recognized for placement-gate evaluation. in_process_fused_root: bool, /// Current level in the tree @@ -640,10 +637,8 @@ impl PlanRewriter { let whole_plan_encodable = DFLogicalSubstraitConvertor .encode(plan, DefaultSerializer) .is_ok(); - let skip_in_process_encodability = in_process_fused_root && !whole_plan_encodable; Self { in_process_fused_root, - skip_in_process_encodability, whole_plan_encodable, ..Default::default() } @@ -677,8 +672,7 @@ impl PlanRewriter { // When the root does not encode, the plan holds at least one node that has to stay // on the frontend and only the per-node check locates it. // - if !self.skip_in_process_encodability - && !self.whole_plan_encodable + if !self.whole_plan_encodable && let Err(e) = DFLogicalSubstraitConvertor.encode(plan, DefaultSerializer) { debug!( diff --git a/src/query/src/dist_plan/analyzer/test.rs b/src/query/src/dist_plan/analyzer/test.rs index b6e0ba1e9e9..033384474dc 100644 --- a/src/query/src/dist_plan/analyzer/test.rs +++ b/src/query/src/dist_plan/analyzer/test.rs @@ -80,7 +80,7 @@ fn analyzer() -> DistPlannerAnalyzer { } #[test] -fn ordinary_encodable_plan_keeps_in_process_encodability_gate() { +fn ordinary_encodable_plan_reports_encodability() { let table = TestTable::table_with_name(0, "t".to_string()); let table_source = Arc::new(DefaultTableSource::new(Arc::new( DfTableProviderAdapter::new(table), @@ -98,11 +98,9 @@ fn ordinary_encodable_plan_keeps_in_process_encodability_gate() { let in_process_rewriter = PlanRewriter::new(&plan, true); assert!(in_process_rewriter.whole_plan_encodable); - assert!(!in_process_rewriter.skip_in_process_encodability); let wire_rewriter = PlanRewriter::new(&plan, false); assert!(wire_rewriter.whole_plan_encodable); - assert!(!wire_rewriter.skip_in_process_encodability); } struct MergeScanRemoteDynFilterProducerIdCollector<'a> {