diff --git a/src/operator/src/statement/tql.rs b/src/operator/src/statement/tql.rs index 03ad3f4976..fe9baaf4c3 100644 --- a/src/operator/src/statement/tql.rs +++ b/src/operator/src/statement/tql.rs @@ -53,10 +53,13 @@ impl StatementExecutor { let promql = PromQuery { query: explain.query, + start: explain.start, + end: explain.end, + step: explain.step, lookback: explain .lookback .unwrap_or_else(|| DEFAULT_LOOKBACK_STRING.to_string()), - ..PromQuery::default() + alias: explain.alias, }; let explain_node_name = if explain.is_verbose { EXPLAIN_VERBOSE_NODE_NAME @@ -68,7 +71,7 @@ impl StatementExecutor { QueryLanguageParser::parse_promql(&promql, query_ctx) .context(ParseQuerySnafu)? .post_process(params) - .unwrap() + .context(ParseQuerySnafu)? } Tql::Analyze(analyze) => { if let Some(format) = &analyze.format { @@ -95,7 +98,7 @@ impl StatementExecutor { QueryLanguageParser::parse_promql(&promql, query_ctx) .context(ParseQuerySnafu)? .post_process(params) - .unwrap() + .context(ParseQuerySnafu)? } }; self.query_engine diff --git a/src/query/src/parser.rs b/src/query/src/parser.rs index 335045f3ef..fa499dd838 100644 --- a/src/query/src/parser.rs +++ b/src/query/src/parser.rs @@ -42,6 +42,7 @@ pub const EXPLAIN_NODE_NAME: &str = "EXPLAIN"; pub const EXPLAIN_VERBOSE_NODE_NAME: &str = "EXPLAIN VERBOSE"; pub const ANALYZE_NODE_NAME: &str = "ANALYZE"; pub const ANALYZE_VERBOSE_NODE_NAME: &str = "ANALYZE VERBOSE"; +pub const ALIAS_NODE_NAME: &str = "ALIAS"; #[derive(Debug, Clone)] pub enum QueryStatement { @@ -190,8 +191,21 @@ impl QueryLanguageParser { interval: step, lookback_delta, }; + if let Some(alias) = &query.alias { + let eval_stmt = Self::apply_alias_extension(eval_stmt, alias); + return Ok(QueryStatement::Promql(eval_stmt, query.alias.clone())); + } + Ok(QueryStatement::Promql(eval_stmt, None)) + } - Ok(QueryStatement::Promql(eval_stmt, query.alias.clone())) + pub(crate) fn apply_alias_extension(mut eval_stmt: EvalStmt, alias: &str) -> EvalStmt { + eval_stmt.expr = Extension(NodeExtension { + expr: Arc::new(AliasExpr { + expr: eval_stmt.expr.clone(), + alias: alias.to_string(), + }), + }); + eval_stmt } pub fn parse_promql_timestamp(timestamp: &str) -> Result { @@ -276,6 +290,36 @@ define_node_ast_extension!( Expr, EXPLAIN_VERBOSE_NODE_NAME ); +#[derive(Debug, Clone)] +pub struct AliasExpr { + pub expr: Expr, + pub alias: String, +} +impl ExtensionExpr for AliasExpr { + fn as_any(&self) -> &dyn Any { + self + } + fn name(&self) -> &str { + ALIAS_NODE_NAME + } + fn value_type(&self) -> ValueType { + self.expr.value_type() + } + fn children(&self) -> &[Expr] { + std::slice::from_ref(&self.expr) + } +} +#[derive(Debug, Clone)] +pub struct Alias { + pub expr: Arc, +} +impl Alias { + pub fn new(expr: Expr, alias: String) -> Self { + Self { + expr: Arc::new(AliasExpr { expr, alias }), + } + } +} #[cfg(test)] mod test { @@ -354,10 +398,16 @@ mod test { let expected = String::from( "\ Promql(EvalStmt { \ - expr: VectorSelector(VectorSelector { \ - name: Some(\"http_request\"), \ - matchers: Matchers { matchers: [], or_matchers: [] }, \ - offset: None, at: None }), \ + expr: Extension(Extension { \ + expr: AliasExpr { \ + expr: VectorSelector(VectorSelector { \ + name: Some(\"http_request\"), \ + matchers: Matchers { matchers: [], or_matchers: [] }, \ + offset: None, at: None \ + }), \ + alias: \"my_query\" \ + } \ + }), \ start: SystemTime { tv_sec: 1644772440, tv_nsec: 0 }, \ end: SystemTime { tv_sec: 1676308440, tv_nsec: 0 }, \ interval: 86400s, \ @@ -370,10 +420,16 @@ mod test { let expected = String::from( "\ Promql(EvalStmt { \ - expr: VectorSelector(VectorSelector { \ - name: Some(\"http_request\"), \ - matchers: Matchers { matchers: [], or_matchers: [] }, \ - offset: None, at: None }), \ + expr: Extension(Extension { \ + expr: AliasExpr { \ + expr: VectorSelector(VectorSelector { \ + name: Some(\"http_request\"), \ + matchers: Matchers { matchers: [], or_matchers: [] }, \ + offset: None, at: None \ + }), \ + alias: \"my_query\" \ + } \ + }), \ start: SystemTime { intervals: 132892460400000000 }, \ end: SystemTime { intervals: 133207820400000000 }, \ interval: 86400s, \ diff --git a/src/query/src/planner.rs b/src/query/src/planner.rs index faba24a742..91ed874a90 100644 --- a/src/query/src/planner.rs +++ b/src/query/src/planner.rs @@ -266,12 +266,7 @@ impl DfLogicalPlanner { } #[tracing::instrument(skip_all)] - async fn plan_pql( - &self, - stmt: &EvalStmt, - alias: Option, - query_ctx: QueryContextRef, - ) -> Result { + async fn plan_pql(&self, stmt: &EvalStmt, query_ctx: QueryContextRef) -> Result { let plan_decoder = Arc::new(DefaultPlanDecoder::new( self.session_state.clone(), &query_ctx, @@ -286,7 +281,7 @@ impl DfLogicalPlanner { .sql_parser .enable_ident_normalization, ); - PromPlanner::stmt_to_plan_with_alias(table_provider, stmt, alias, &self.engine_state) + PromPlanner::stmt_to_plan(table_provider, stmt, &self.engine_state) .await .map_err(BoxedError::new) .context(QueryPlanSnafu) @@ -418,9 +413,7 @@ impl LogicalPlanner for DfLogicalPlanner { async fn plan(&self, stmt: &QueryStatement, query_ctx: QueryContextRef) -> Result { match stmt { QueryStatement::Sql(stmt) => self.plan_sql(stmt, query_ctx).await, - QueryStatement::Promql(stmt, alias) => { - self.plan_pql(stmt, alias.clone(), query_ctx).await - } + QueryStatement::Promql(stmt, _alias) => self.plan_pql(stmt, query_ctx).await, } } diff --git a/src/query/src/promql/planner.rs b/src/query/src/promql/planner.rs index c7655214cd..e957a5deba 100644 --- a/src/query/src/promql/planner.rs +++ b/src/query/src/promql/planner.rs @@ -81,6 +81,10 @@ use store_api::metric_engine_consts::{ }; use table::table::adapter::DfTableProviderAdapter; +use crate::parser::{ + ALIAS_NODE_NAME, ANALYZE_NODE_NAME, ANALYZE_VERBOSE_NODE_NAME, AliasExpr, EXPLAIN_NODE_NAME, + EXPLAIN_VERBOSE_NODE_NAME, +}; use crate::promql::error::{ CatalogSnafu, ColumnNotFoundSnafu, CombineTableColumnMismatchSnafu, DataFusionPlanningSnafu, ExpectRangeSelectorSnafu, FunctionInvalidArgumentSnafu, InvalidDestinationLabelNameSnafu, @@ -200,10 +204,9 @@ pub struct PromPlanner { } impl PromPlanner { - pub async fn stmt_to_plan_with_alias( + pub async fn stmt_to_plan( table_provider: DfTableSourceProvider, stmt: &EvalStmt, - alias: Option, query_engine_state: &QueryEngineState, ) -> Result { let mut planner = Self { @@ -215,26 +218,10 @@ impl PromPlanner { .prom_expr_to_plan(&stmt.expr, query_engine_state) .await?; - // Apply alias if provided - let plan = if let Some(alias_name) = alias { - planner.apply_alias_projection(plan, alias_name)? - } else { - plan - }; - // Never leak internal series identifier to output. planner.strip_tsid_column(plan) } - #[cfg(test)] - async fn stmt_to_plan( - table_provider: DfTableSourceProvider, - stmt: &EvalStmt, - query_engine_state: &QueryEngineState, - ) -> Result { - Self::stmt_to_plan_with_alias(table_provider, stmt, None, query_engine_state).await - } - pub async fn prom_expr_to_plan( &mut self, prom_expr: &PromExpr, @@ -1126,26 +1113,37 @@ impl PromPlanner { // information about metrics during run. // if `verbose` is true, prints out additional details when VERBOSE keyword is specified match expr.name() { - "ANALYZE" => LogicalPlanBuilder::from(plan) + ANALYZE_NODE_NAME => LogicalPlanBuilder::from(plan) .explain(false, true) .unwrap() .build() .context(DataFusionPlanningSnafu), - "ANALYZE VERBOSE" => LogicalPlanBuilder::from(plan) + ANALYZE_VERBOSE_NODE_NAME => LogicalPlanBuilder::from(plan) .explain(true, true) .unwrap() .build() .context(DataFusionPlanningSnafu), - "EXPLAIN" => LogicalPlanBuilder::from(plan) + EXPLAIN_NODE_NAME => LogicalPlanBuilder::from(plan) .explain(false, false) .unwrap() .build() .context(DataFusionPlanningSnafu), - "EXPLAIN VERBOSE" => LogicalPlanBuilder::from(plan) + EXPLAIN_VERBOSE_NODE_NAME => LogicalPlanBuilder::from(plan) .explain(true, false) .unwrap() .build() .context(DataFusionPlanningSnafu), + ALIAS_NODE_NAME => { + let alias = expr + .as_any() + .downcast_ref::() + .context(UnexpectedPlanExprSnafu { + desc: "Expected AliasExpr", + })? + .alias + .clone(); + self.apply_alias(plan, alias) + } _ => LogicalPlanBuilder::empty(true) .build() .context(DataFusionPlanningSnafu), @@ -3949,11 +3947,7 @@ impl PromPlanner { } /// Apply an alias to the query result by adding a projection with the alias name - fn apply_alias_projection( - &mut self, - plan: LogicalPlan, - alias_name: String, - ) -> Result { + fn apply_alias(&mut self, plan: LogicalPlan, alias_name: String) -> Result { let fields_expr = self.create_field_column_exprs()?; // TODO(dennis): how to support multi-value aliasing? @@ -4034,6 +4028,7 @@ mod test { use super::*; use crate::options::QueryOptions; + use crate::parser::QueryLanguageParser; fn build_query_engine_state() -> QueryEngineState { QueryEngineState::new( @@ -6190,6 +6185,7 @@ Filter: up.field_0 IS NOT NULL [timestamp:Timestamp(Millisecond, None), field_0: let prom_expr = parser::parse(case).unwrap(); eval_stmt.expr = prom_expr; + eval_stmt = QueryLanguageParser::apply_alias_extension(eval_stmt, "my_series"); let table_provider = build_test_table_provider_with_fields( &[ ( @@ -6205,15 +6201,10 @@ Filter: up.field_0 IS NOT NULL [timestamp:Timestamp(Millisecond, None), field_0: ) .await; - let alias = Some("my_series".to_string()); - let plan = PromPlanner::stmt_to_plan_with_alias( - table_provider, - &eval_stmt, - alias, - &build_query_engine_state(), - ) - .await - .unwrap(); + let plan = + PromPlanner::stmt_to_plan(table_provider, &eval_stmt, &build_query_engine_state()) + .await + .unwrap(); let expected = r#" Projection: count(prometheus_tsdb_head_series.greptime_value) AS my_series, prometheus_tsdb_head_series.ip, prometheus_tsdb_head_series.greptime_timestamp [my_series:Int64, ip:Utf8, greptime_timestamp:Timestamp(Millisecond, None)] Projection: count(prometheus_tsdb_head_series.greptime_value), prometheus_tsdb_head_series.ip, prometheus_tsdb_head_series.greptime_timestamp, series [count(prometheus_tsdb_head_series.greptime_value):Int64, ip:Utf8, greptime_timestamp:Timestamp(Millisecond, None), series:Float64;N] diff --git a/tests/cases/distributed/explain/step_aggr_advance.result b/tests/cases/distributed/explain/step_aggr_advance.result index efa3c8a73f..1451b1619f 100644 --- a/tests/cases/distributed/explain/step_aggr_advance.result +++ b/tests/cases/distributed/explain/step_aggr_advance.result @@ -30,11 +30,11 @@ tql explain (1752591864, 1752592164, '30s') max by (a, b, c) (max_over_time(aggr | | Aggregate: groupBy=[[aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.greptime_timestamp]], aggr=[[max(prom_max_over_time(greptime_timestamp_range,greptime_value))]] | | | Filter: prom_max_over_time(greptime_timestamp_range,greptime_value) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_max_over_time(greptime_timestamp_range, greptime_value) AS prom_max_over_time(greptime_timestamp_range,greptime_value), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | physical_plan | SortPreservingMergeExec: [a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST, greptime_timestamp@3 ASC NULLS LAST] | @@ -109,11 +109,11 @@ tql explain (1752591864, 1752592164, '30s') sum by (a, b) (max_over_time(aggr_op | | Aggregate: groupBy=[[aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.greptime_timestamp]], aggr=[[__sum_state(prom_max_over_time(greptime_timestamp_range,greptime_value))]] | | | Filter: prom_max_over_time(greptime_timestamp_range,greptime_value) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_max_over_time(greptime_timestamp_range, greptime_value) AS prom_max_over_time(greptime_timestamp_range,greptime_value), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | physical_plan | SortPreservingMergeExec: [a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, greptime_timestamp@2 ASC NULLS LAST] | @@ -192,11 +192,11 @@ tql explain (1752591864, 1752592164, '30s') avg by (a) (max_over_time(aggr_optim | | Aggregate: groupBy=[[aggr_optimize_not.a, aggr_optimize_not.greptime_timestamp]], aggr=[[__avg_state(prom_max_over_time(greptime_timestamp_range,greptime_value))]] | | | Filter: prom_max_over_time(greptime_timestamp_range,greptime_value) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_max_over_time(greptime_timestamp_range, greptime_value) AS prom_max_over_time(greptime_timestamp_range,greptime_value), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | physical_plan | SortPreservingMergeExec: [a@0 ASC NULLS LAST, greptime_timestamp@1 ASC NULLS LAST] | @@ -275,11 +275,11 @@ tql explain (1752591864, 1752592164, '30s') count by (a, b, c, d) (max_over_time | | Aggregate: groupBy=[[aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d, aggr_optimize_not.greptime_timestamp]], aggr=[[count(prom_max_over_time(greptime_timestamp_range,greptime_value))]] | | | Filter: prom_max_over_time(greptime_timestamp_range,greptime_value) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_max_over_time(greptime_timestamp_range, greptime_value) AS prom_max_over_time(greptime_timestamp_range,greptime_value), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | physical_plan | SortPreservingMergeExec: [a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST, d@3 ASC NULLS LAST, greptime_timestamp@4 ASC NULLS LAST] | @@ -354,11 +354,11 @@ tql explain (1752591864, 1752592164, '30s') min by (b, c, d) (max_over_time(aggr | | Aggregate: groupBy=[[aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d, aggr_optimize_not.greptime_timestamp]], aggr=[[__min_state(prom_max_over_time(greptime_timestamp_range,greptime_value))]] | | | Filter: prom_max_over_time(greptime_timestamp_range,greptime_value) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_max_over_time(greptime_timestamp_range, greptime_value) AS prom_max_over_time(greptime_timestamp_range,greptime_value), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | physical_plan | SortPreservingMergeExec: [b@0 ASC NULLS LAST, c@1 ASC NULLS LAST, d@2 ASC NULLS LAST, greptime_timestamp@3 ASC NULLS LAST] | @@ -528,11 +528,11 @@ tql explain (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize | | Aggregate: groupBy=[[aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.greptime_timestamp]], aggr=[[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))]] | | | Filter: prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)) IS NOT NULL | | | Projection: aggr_optimize_not.greptime_timestamp, prom_rate(greptime_timestamp_range, greptime_value, aggr_optimize_not.greptime_timestamp, Int64(120000)) AS prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), aggr_optimize_not.a, aggr_optimize_not.b, aggr_optimize_not.c, aggr_optimize_not.d | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not.a ASC NULLS FIRST, aggr_optimize_not.b ASC NULLS FIRST, aggr_optimize_not.c ASC NULLS FIRST, aggr_optimize_not.d ASC NULLS FIRST, aggr_optimize_not.greptime_timestamp ASC NULLS FIRST | -| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not | | | ]] | | | SubqueryAlias: aggr_optimize_not_count | @@ -540,41 +540,37 @@ tql explain (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize | | Aggregate: groupBy=[[aggr_optimize_not_count.a, aggr_optimize_not_count.b, aggr_optimize_not_count.c, aggr_optimize_not_count.greptime_timestamp]], aggr=[[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))]] | | | Filter: prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)) IS NOT NULL | | | Projection: aggr_optimize_not_count.greptime_timestamp, prom_rate(greptime_timestamp_range, greptime_value, aggr_optimize_not_count.greptime_timestamp, Int64(120000)) AS prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), aggr_optimize_not_count.a, aggr_optimize_not_count.b, aggr_optimize_not_count.c | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | +| | PromRangeManipulate: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp], values=["greptime_value"] | | | PromSeriesNormalize: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | | | PromSeriesDivide: tags=["a", "b", "c", "d"] | | | Sort: aggr_optimize_not_count.a ASC NULLS FIRST, aggr_optimize_not_count.b ASC NULLS FIRST, aggr_optimize_not_count.c ASC NULLS FIRST, aggr_optimize_not_count.d ASC NULLS FIRST, aggr_optimize_not_count.greptime_timestamp ASC NULLS FIRST | | | MergeScan [is_placeholder=false, remote_input=[ | -| | Filter: aggr_optimize_not_count.greptime_timestamp >= TimestampMillisecond(-119999, None) AND aggr_optimize_not_count.greptime_timestamp <= TimestampMillisecond(0, None) | +| | Filter: aggr_optimize_not_count.greptime_timestamp >= TimestampMillisecond(1752591744001, None) AND aggr_optimize_not_count.greptime_timestamp <= TimestampMillisecond(1752592164000, None) | | | TableScan: aggr_optimize_not_count | | | ]] | -| physical_plan | ProjectionExec: expr=[a@1 as a, b@2 as b, c@3 as c, greptime_timestamp@4 as greptime_timestamp, sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@0 / sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@5 as aggr_optimize_not.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))) / aggr_optimize_not_count.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | +| physical_plan | ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp, sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@5 / sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@4 as aggr_optimize_not.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))) / aggr_optimize_not_count.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | | | CoalesceBatchesExec: target_batch_size=8192 | | | REDACTED -| | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | CooperativeExec | -| | CooperativeExec | -| | MergeScanExec: REDACTED -| | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | SortPreservingMergeExec: [a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST, greptime_timestamp@3 ASC NULLS LAST] | -| | SortExec: expr=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST, greptime_timestamp@3 ASC NULLS LAST], preserve_partitioning=[true] | -| | AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | +| | CoalescePartitionsExec | +| | AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | +| | CoalesceBatchesExec: target_batch_size=8192 | +| | RepartitionExec: partitioning=REDACTED +| | AggregateExec: mode=Partial, gby=[a@2 as a, b@3 as b, c@4 as c, greptime_timestamp@0 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | | | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | AggregateExec: mode=Partial, gby=[a@2 as a, b@3 as b, c@4 as c, greptime_timestamp@0 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | -| | CoalesceBatchesExec: target_batch_size=8192 | -| | FilterExec: prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))@1 IS NOT NULL | -| | ProjectionExec: expr=[greptime_timestamp@4 as greptime_timestamp, prom_rate(greptime_timestamp_range@6, greptime_value@5, greptime_timestamp@4, 120000) as prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), a@0 as a, b@1 as b, c@2 as c] | -| | PromRangeManipulateExec: req range=[0..0], interval=[300000], eval range=[120000], time index=[greptime_timestamp] | -| | PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | -| | PromSeriesDivideExec: tags=["a", "b", "c", "d"] | -| | SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] | -| | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | CooperativeExec | -| | MergeScanExec: REDACTED +| | FilterExec: prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))@1 IS NOT NULL | +| | ProjectionExec: expr=[greptime_timestamp@4 as greptime_timestamp, prom_rate(greptime_timestamp_range@6, greptime_value@5, greptime_timestamp@4, 120000) as prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), a@0 as a, b@1 as b, c@2 as c] | +| | PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] | +| | PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] | +| | PromSeriesDivideExec: tags=["a", "b", "c", "d"] | +| | SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] | +| | CoalesceBatchesExec: target_batch_size=8192 | +| | RepartitionExec: partitioning=REDACTED +| | CooperativeExec | +| | MergeScanExec: REDACTED +| | CooperativeExec | +| | SortExec: expr=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST, greptime_timestamp@3 ASC NULLS LAST], preserve_partitioning=[true] | +| | CooperativeExec | +| | MergeScanExec: REDACTED | | | +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/tests/cases/distributed/flow-tql/tsid_on_phy.result b/tests/cases/distributed/flow-tql/tsid_on_phy.result index 7b9e198038..322d451ab2 100644 --- a/tests/cases/distributed/flow-tql/tsid_on_phy.result +++ b/tests/cases/distributed/flow-tql/tsid_on_phy.result @@ -109,11 +109,11 @@ TQL EXPLAIN ( | | Aggregate: groupBy=[[test_tsid.le, test_tsid.tag4, test_tsid.tag5, test_tsid.ts]], aggr=[[sum(prom_avg_over_time(ts_range,v))]] | | | Filter: prom_avg_over_time(ts_range,v) IS NOT NULL | | | Projection: test_tsid.ts, prom_avg_over_time(ts_range, v) AS prom_avg_over_time(ts_range,v), test_tsid.le, test_tsid.tag1, test_tsid.tag2, test_tsid.tag4, test_tsid.tag5, test_tsid.tag6, test_tsid.tag7, test_tsid.tag8 | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[1800000], time index=[ts], values=["v"] | +| | PromRangeManipulate: req range=[1769139000000..1769139900000], interval=[60000], eval range=[1800000], time index=[ts], values=["v"] | | | PromSeriesNormalize: offset=[0], time index=[ts], filter NaN: [true] | | | PromSeriesDivide: tags=["__tsid"] | | | Sort: test_tsid.__tsid ASC NULLS FIRST, test_tsid.ts ASC NULLS FIRST | -| | Filter: test_tsid.ts >= TimestampMillisecond(-1799999, None) AND test_tsid.ts <= TimestampMillisecond(0, None) | +| | Filter: test_tsid.ts >= TimestampMillisecond(1769137200001, None) AND test_tsid.ts <= TimestampMillisecond(1769139900000, None) | | | Projection: test_tsid.v, test_tsid.le, test_tsid.tag1, test_tsid.tag2, test_tsid.tag4, test_tsid.tag5, test_tsid.tag6, test_tsid.tag7, test_tsid.tag8, test_tsid.__tsid, test_tsid.ts | | | SubqueryAlias: test_tsid | | | Filter: phy.__table_id=UInt32(REDACTED) | diff --git a/tests/cases/standalone/common/promql/encode_substrait.result b/tests/cases/standalone/common/promql/encode_substrait.result index 2edc009ac9..a154d9e5a2 100644 --- a/tests/cases/standalone/common/promql/encode_substrait.result +++ b/tests/cases/standalone/common/promql/encode_substrait.result @@ -20,14 +20,14 @@ tql explain (0, 100, '1s') | plan_type | plan | +---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | logical_plan | MergeScan [is_placeholder=false, remote_input=[ | -| | PromRangeManipulate: req range=[0..0], interval=[300000], eval range=[43200000], time index=[ts], values=["prom_increase(ts_range,val,ts,Int64(3600000))"] | +| | PromRangeManipulate: req range=[0..100000], interval=[1000], eval range=[43200000], time index=[ts], values=["prom_increase(ts_range,val,ts,Int64(3600000))"] | | | Filter: prom_increase(ts_range,val,ts,Int64(3600000)) IS NOT NULL | | | Projection: count_total.ts, prom_increase(ts_range, val, count_total.ts, Int64(3600000)) AS prom_increase(ts_range,val,ts,Int64(3600000)), count_total.tag_a, count_total.tag_b | -| | PromRangeManipulate: req range=[-39600000..0], interval=[3600000], eval range=[3600000], time index=[ts], values=["val"] | +| | PromRangeManipulate: req range=[-39600000..100000], interval=[3600000], eval range=[3600000], time index=[ts], values=["val"] | | | PromSeriesNormalize: offset=[0], time index=[ts], filter NaN: [true] | | | PromSeriesDivide: tags=["tag_a", "tag_b"] | | | Sort: count_total.tag_a ASC NULLS FIRST, count_total.tag_b ASC NULLS FIRST, count_total.ts ASC NULLS FIRST | -| | Filter: count_total.tag_a = Utf8("ffa") AND count_total.ts >= TimestampMillisecond(-43199999, None) AND count_total.ts <= TimestampMillisecond(0, None) | +| | Filter: count_total.tag_a = Utf8("ffa") AND count_total.ts >= TimestampMillisecond(-43199999, None) AND count_total.ts <= TimestampMillisecond(100000, None) | | | TableScan: count_total | | | ]] | | physical_plan | CooperativeExec | diff --git a/tests/cases/standalone/common/tql-explain-analyze/explain.result b/tests/cases/standalone/common/tql-explain-analyze/explain.result index dcb877ae36..334c9e7eec 100644 --- a/tests/cases/standalone/common/tql-explain-analyze/explain.result +++ b/tests/cases/standalone/common/tql-explain-analyze/explain.result @@ -12,20 +12,20 @@ Affected Rows: 3 -- SQLNESS REPLACE (peers.*) REDACTED TQL EXPLAIN (0, 10, '5s') test; -+---------------+---------------------------------------------------------------------------------------------------------+ -| plan_type | plan | -+---------------+---------------------------------------------------------------------------------------------------------+ -| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | -| | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j] | -| | PromSeriesDivide: tags=["k"] | -| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | -| | Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None) | -| | TableScan: test | -| | ]] | -| physical_plan | CooperativeExec | ++---------------+-------------------------------------------------------------------------------------------------------------+ +| plan_type | plan | ++---------------+-------------------------------------------------------------------------------------------------------------+ +| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | +| | PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] | +| | PromSeriesDivide: tags=["k"] | +| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | +| | Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None) | +| | TableScan: test | +| | ]] | +| physical_plan | CooperativeExec | | | MergeScanExec: REDACTED -| | | -+---------------+---------------------------------------------------------------------------------------------------------+ +| | | ++---------------+-------------------------------------------------------------------------------------------------------------+ -- 'lookback' parameter is not fully supported, the test has to be updated -- explain at 0s, 5s and 10s. No point at 0s. @@ -33,40 +33,40 @@ TQL EXPLAIN (0, 10, '5s') test; -- SQLNESS REPLACE (peers.*) REDACTED TQL EXPLAIN (0, 10, '1s', '2s') test; -+---------------+-------------------------------------------------------------------------------------------------------+ -| plan_type | plan | -+---------------+-------------------------------------------------------------------------------------------------------+ -| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | -| | PromInstantManipulate: range=[0..0], lookback=[2000], interval=[300000], time index=[j] | -| | PromSeriesDivide: tags=["k"] | -| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | -| | Filter: test.j >= TimestampMillisecond(-1999, None) AND test.j <= TimestampMillisecond(0, None) | -| | TableScan: test | -| | ]] | -| physical_plan | CooperativeExec | ++---------------+-----------------------------------------------------------------------------------------------------------+ +| plan_type | plan | ++---------------+-----------------------------------------------------------------------------------------------------------+ +| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | +| | PromInstantManipulate: range=[0..10000], lookback=[2000], interval=[1000], time index=[j] | +| | PromSeriesDivide: tags=["k"] | +| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | +| | Filter: test.j >= TimestampMillisecond(-1999, None) AND test.j <= TimestampMillisecond(10000, None) | +| | TableScan: test | +| | ]] | +| physical_plan | CooperativeExec | | | MergeScanExec: REDACTED -| | | -+---------------+-------------------------------------------------------------------------------------------------------+ +| | | ++---------------+-----------------------------------------------------------------------------------------------------------+ -- explain at 0s, 5s and 10s. No point at 0s. -- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED -- SQLNESS REPLACE (peers.*) REDACTED TQL EXPLAIN ('1970-01-01T00:00:00'::timestamp, '1970-01-01T00:00:00'::timestamp + '10 seconds'::interval, '5s') test; -+---------------+---------------------------------------------------------------------------------------------------------+ -| plan_type | plan | -+---------------+---------------------------------------------------------------------------------------------------------+ -| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | -| | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j] | -| | PromSeriesDivide: tags=["k"] | -| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | -| | Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None) | -| | TableScan: test | -| | ]] | -| physical_plan | CooperativeExec | ++---------------+-------------------------------------------------------------------------------------------------------------+ +| plan_type | plan | ++---------------+-------------------------------------------------------------------------------------------------------------+ +| logical_plan | MergeScan [is_placeholder=false, remote_input=[ | +| | PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] | +| | PromSeriesDivide: tags=["k"] | +| | Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST | +| | Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None) | +| | TableScan: test | +| | ]] | +| physical_plan | CooperativeExec | | | MergeScanExec: REDACTED -| | | -+---------------+---------------------------------------------------------------------------------------------------------+ +| | | ++---------------+-------------------------------------------------------------------------------------------------------------+ -- explain verbose at 0s, 5s and 10s. No point at 0s. -- SQLNESS REPLACE (-+) - @@ -79,10 +79,10 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; +-+-+ | plan_type_| plan_| +-+-+ -| initial_logical_plan_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +| initial_logical_plan_| PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| | logical_plan after count_wildcard_to_time_index_rule_| SAME TEXT AS ABOVE_| | logical_plan after StringNormalizationRule_| SAME TEXT AS ABOVE_| @@ -91,10 +91,10 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; | logical_plan after type_coercion_| SAME TEXT AS ABOVE_| | logical_plan after DistPlannerAnalyzer_| Projection: test.i, test.j, test.k_| |_|_MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | logical_plan after FixStateUdafOrderingAnalyzer_| SAME TEXT AS ABOVE_| @@ -121,10 +121,10 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; | logical_plan after eliminate_group_by_constant_| SAME TEXT AS ABOVE_| | logical_plan after common_sub_expression_eliminate_| SAME TEXT AS ABOVE_| | logical_plan after optimize_projections_| MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | logical_plan after ScanHintRule_| SAME TEXT AS ABOVE_| @@ -152,10 +152,10 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; | logical_plan after optimize_projections_| SAME TEXT AS ABOVE_| | logical_plan after ScanHintRule_| SAME TEXT AS ABOVE_| | logical_plan_| MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | initial_physical_plan_| MergeScanExec: REDACTED @@ -217,22 +217,24 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test AS series; +-+-+ | plan_type_| plan_| +-+-+ -| initial_logical_plan_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +| initial_logical_plan_| Projection: test.i AS series, test.k, test.j_| +|_|_PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| | logical_plan after count_wildcard_to_time_index_rule_| SAME TEXT AS ABOVE_| | logical_plan after StringNormalizationRule_| SAME TEXT AS ABOVE_| | logical_plan after TranscribeAtatRule_| SAME TEXT AS ABOVE_| | logical_plan after resolve_grouping_function_| SAME TEXT AS ABOVE_| | logical_plan after type_coercion_| SAME TEXT AS ABOVE_| -| logical_plan after DistPlannerAnalyzer_| Projection: test.i, test.j, test.k_| +| logical_plan after DistPlannerAnalyzer_| Projection: series, test.k, test.j_| |_|_MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| Projection: test.i AS series, test.k, test.j_| +|_|_PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | logical_plan after FixStateUdafOrderingAnalyzer_| SAME TEXT AS ABOVE_| @@ -259,10 +261,11 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test AS series; | logical_plan after eliminate_group_by_constant_| SAME TEXT AS ABOVE_| | logical_plan after common_sub_expression_eliminate_| SAME TEXT AS ABOVE_| | logical_plan after optimize_projections_| MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| Projection: test.i AS series, test.k, test.j_| +|_|_PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | logical_plan after ScanHintRule_| SAME TEXT AS ABOVE_| @@ -290,10 +293,11 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test AS series; | logical_plan after optimize_projections_| SAME TEXT AS ABOVE_| | logical_plan after ScanHintRule_| SAME TEXT AS ABOVE_| | logical_plan_| MergeScan [is_placeholder=false, remote_input=[_| -|_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_| +|_| Projection: test.i AS series, test.k, test.j_| +|_|_PromInstantManipulate: range=[0..10000], lookback=[300000], interval=[5000], time index=[j]_| |_|_PromSeriesDivide: tags=["k"]_| |_|_Sort: test.k ASC NULLS FIRST, test.j ASC NULLS FIRST_| -|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(0, None)_| +|_|_Filter: test.j >= TimestampMillisecond(-299999, None) AND test.j <= TimestampMillisecond(10000, None)_| |_|_TableScan: test_| |_| ]]_| | initial_physical_plan_| MergeScanExec: REDACTED @@ -339,7 +343,7 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test AS series; | physical_plan_with_stats_| CooperativeExec, statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_| |_|_MergeScanExec: REDACTED |_|_| -| physical_plan_with_schema_| CooperativeExec, schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_| +| physical_plan_with_schema_| CooperativeExec, schema=[series:Float64;N, k:Utf8;N, j:Timestamp(Millisecond, None)]_| |_|_MergeScanExec: REDACTED |_|_| +-+-+