mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
fix: put PipelineChecker at the end (#5092)
fix: put PipelineChecker in the end Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -32,6 +32,8 @@ use datafusion::error::Result as DfResult;
|
||||
use datafusion::execution::context::{QueryPlanner, SessionConfig, SessionContext, SessionState};
|
||||
use datafusion::execution::runtime_env::RuntimeEnv;
|
||||
use datafusion::physical_optimizer::optimizer::PhysicalOptimizer;
|
||||
use datafusion::physical_optimizer::pipeline_checker::PipelineChecker;
|
||||
use datafusion::physical_optimizer::PhysicalOptimizerRule;
|
||||
use datafusion::physical_plan::ExecutionPlan;
|
||||
use datafusion::physical_planner::{DefaultPhysicalPlanner, ExtensionPlanner, PhysicalPlanner};
|
||||
use datafusion_expr::LogicalPlan as DfLogicalPlan;
|
||||
@@ -127,6 +129,12 @@ impl QueryEngineState {
|
||||
.push(Arc::new(WindowedSortPhysicalRule));
|
||||
// Add rule to remove duplicate nodes generated by other rules. Run this in the last.
|
||||
physical_optimizer.rules.push(Arc::new(RemoveDuplicate));
|
||||
// Place PipelineChecker at the end of the list to ensure that it runs after all other rules.
|
||||
Self::remove_physical_optimizer_rule(
|
||||
&mut physical_optimizer.rules,
|
||||
PipelineChecker {}.name(),
|
||||
);
|
||||
physical_optimizer.rules.push(Arc::new(PipelineChecker {}));
|
||||
|
||||
let session_state = SessionState::new_with_config_rt(session_config, runtime_env)
|
||||
.with_analyzer_rules(analyzer.rules)
|
||||
@@ -159,6 +167,13 @@ impl QueryEngineState {
|
||||
rules.retain(|rule| rule.name() != name);
|
||||
}
|
||||
|
||||
fn remove_physical_optimizer_rule(
|
||||
rules: &mut Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>,
|
||||
name: &str,
|
||||
) {
|
||||
rules.retain(|rule| rule.name() != name);
|
||||
}
|
||||
|
||||
/// Optimize the logical plan by the extension anayzer rules.
|
||||
pub fn optimize_by_extension_rules(
|
||||
&self,
|
||||
|
||||
@@ -182,9 +182,9 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test;
|
||||
|_|_|
|
||||
| physical_plan after LimitAggregation_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan after ProjectionPushdown_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan after PipelineChecker_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan after WindowedSortRule_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan after RemoveDuplicateRule_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan after PipelineChecker_| SAME TEXT AS ABOVE_|
|
||||
| physical_plan_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
||||
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
||||
|_|_PromSeriesDivideExec: tags=["k"]_|
|
||||
|
||||
Reference in New Issue
Block a user