From b1853b2fa096acc67b97d138830974f2f72db990 Mon Sep 17 00:00:00 2001
From: ljl <17743125563@163.com>
Date: Thu, 21 Mar 2024 16:19:04 +0800
Subject: [PATCH] spi-stats:fix dimension hierarchy.
---
.../src/serv/pg/stats_pg_metric_serv.rs | 106 ++++++++++++++++--
1 file changed, 99 insertions(+), 7 deletions(-)
diff --git a/spi/spi-stats/src/serv/pg/stats_pg_metric_serv.rs b/spi/spi-stats/src/serv/pg/stats_pg_metric_serv.rs
index f89a9aeb1..604213757 100644
--- a/spi/spi-stats/src/serv/pg/stats_pg_metric_serv.rs
+++ b/spi/spi-stats/src/serv/pg/stats_pg_metric_serv.rs
@@ -8,17 +8,20 @@ use bios_basic::spi::{
use itertools::Itertools;
use tardis::{
basic::{dto::TardisContext, error::TardisError, result::TardisResult},
+ config::config_dto::log,
db::{
- reldb_client::TardisRelDBClient,
+ reldb_client::{TardisRelDBClient, TardisRelDBlConnection},
sea_orm::{self, FromQueryResult, Value},
},
log::info,
serde_json::{self, json, Map},
+ web::poem_openapi::types::{ToJSON, Type},
TardisFunsInst,
};
use crate::{
- dto::stats_query_dto::{StatsQueryMetricsReq, StatsQueryMetricsResp},
+ dto::stats_query_dto::{StatsQueryMetricsReq, StatsQueryMetricsResp, StatsQueryStatementReq, StatsQueryStatementResp},
+ serv::stats_record_serv::dim_record_paginate,
stats_enumeration::{StatsDataTypeKind, StatsFactColKind},
};
@@ -115,11 +118,13 @@ pub async fn query_metrics(query_req: &StatsQueryMetricsReq, funs: &TardisFunsIn
col.key as col_key,
col.show_name as show_name,
col.kind as col_kind,
+ col.dim_rel_conf_dim_key as dim_rel_conf_dim_key,
col.dim_multi_values as dim_multi_values,
col.mes_data_distinct as mes_data_distinct,
col.mes_data_type as mes_data_type,
col.mes_unit as mes_unit,
dim.data_type as dim_data_type,
+ dim.hierarchy as dim_hierarchy,
fact.query_limit as query_limit
FROM
{fact_col_conf_table_name} col
@@ -153,6 +158,16 @@ pub async fn query_metrics(query_req: &StatsQueryMetricsReq, funs: &TardisFunsIn
Some(item.try_get("", "dim_data_type")?)
},
query_limit: item.try_get("", "query_limit")?,
+ dim_rel_conf_dim_key: if item.try_get::