mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-28 05:34:02 +00:00
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 <discord9@163.com>
This commit is contained in:
@@ -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!(
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user