fix: do not change timestamp index column while planning aggr (#1688)

* fix: do not change timestamp index column while planning aggr

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* remove println

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-06-01 20:17:18 +08:00
committed by GitHub
parent ef15de5f17
commit 5a5e88353c
2 changed files with 12 additions and 15 deletions

View File

@@ -141,9 +141,6 @@ impl PromPlanner {
// convert op and value columns to aggregate exprs
let aggr_exprs = self.create_aggregate_exprs(*op, &input)?;
// remove time index column from context
self.ctx.time_index_column = None;
// create plan
let group_sort_expr = group_exprs
.clone()

View File

@@ -414,12 +414,12 @@ async fn aggregators_complex_combined_aggrs(instance: Arc<dyn MockInstance>) {
unix_epoch_plus_100s(),
Duration::from_secs(60),
Duration::from_secs(0),
"+------------+-----------------------------------------------------------------------------------------------------------+\
\n| job | SUM(http_requests.value) + MIN(http_requests.value) + MAX(http_requests.value) + AVG(http_requests.value) |\
\n+------------+-----------------------------------------------------------------------------------------------------------+\
\n| api-server | 1750.0 |\
\n| app-server | 4550.0 |\
\n+------------+-----------------------------------------------------------------------------------------------------------+",
"+------------+---------------------+-----------------------------------------------------------------------------------------------------------+\
\n| job | ts | SUM(http_requests.value) + MIN(http_requests.value) + MAX(http_requests.value) + AVG(http_requests.value) |\
\n+------------+---------------------+-----------------------------------------------------------------------------------------------------------+\
\n| api-server | 1970-01-01T00:00:00 | 1750.0 |\
\n| app-server | 1970-01-01T00:00:00 | 4550.0 |\
\n+------------+---------------------+-----------------------------------------------------------------------------------------------------------+",
)
.await;
}
@@ -439,12 +439,12 @@ async fn two_aggregators_combined_aggrs(instance: Arc<dyn MockInstance>) {
unix_epoch_plus_100s(),
Duration::from_secs(60),
Duration::from_secs(0),
"+------------+-----------------------------------------------------+\
\n| job | SUM(http_requests.value) + MIN(http_requests.value) |\
\n+------------+-----------------------------------------------------+\
\n| api-server | 1100.0 |\
\n| app-server | 3100.0 |\
\n+------------+-----------------------------------------------------+",
"+------------+---------------------+-----------------------------------------------------+\
\n| job | ts | SUM(http_requests.value) + MIN(http_requests.value) |\
\n+------------+---------------------+-----------------------------------------------------+\
\n| api-server | 1970-01-01T00:00:00 | 1100.0 |\
\n| app-server | 1970-01-01T00:00:00 | 3100.0 |\
\n+------------+---------------------+-----------------------------------------------------+",
)
.await;
}