Skip to content

Commit

Permalink
chore(executor): human profile statistics value for explain analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
zhang2014 committed Feb 3, 2024
1 parent b6e05ca commit 44dd650
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/query/pipeline/core/src/processors/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::HashMap;
use std::collections::BTreeMap;
use std::fmt::Display;
use std::fmt::Formatter;
use std::sync::Arc;
Expand All @@ -22,7 +22,7 @@ use databend_common_base::base::convert_byte_size;
use databend_common_base::base::convert_number_size;
use once_cell::sync::OnceCell;

#[derive(Clone, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize, Debug)]
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, serde::Deserialize, Debug)]
pub enum ProfileStatisticsName {
/// The time spent to process in nanoseconds
CpuTime,
Expand Down Expand Up @@ -96,7 +96,7 @@ impl ProfileDesc {
}
}

pub static PROFILES_DESC: OnceCell<Arc<HashMap<ProfileStatisticsName, ProfileDesc>>> =
pub static PROFILES_DESC: OnceCell<Arc<BTreeMap<ProfileStatisticsName, ProfileDesc>>> =
OnceCell::new();

pub static PROFILES_INDEX: OnceCell<
Expand All @@ -119,9 +119,9 @@ fn get_statistics_name_index()
.clone()
}

pub fn get_statistics_desc() -> Arc<HashMap<ProfileStatisticsName, ProfileDesc>> {
pub fn get_statistics_desc() -> Arc<BTreeMap<ProfileStatisticsName, ProfileDesc>> {
PROFILES_DESC.get_or_init(|| {
Arc::new(HashMap::from([
Arc::new(BTreeMap::from([
(ProfileStatisticsName::CpuTime, ProfileDesc {
display_name: "cpu time",
desc: "The time spent to process in nanoseconds",
Expand Down
4 changes: 2 additions & 2 deletions src/query/service/src/interpreters/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::HashMap;
use std::collections::BTreeMap;
use std::sync::Arc;
use std::time::SystemTime;

Expand Down Expand Up @@ -95,7 +95,7 @@ pub trait Interpreter: Sync + Send {
struct QueryProfiles {
query_id: String,
profiles: Vec<PlanProfile>,
statistics_desc: Arc<HashMap<ProfileStatisticsName, ProfileDesc>>,
statistics_desc: Arc<BTreeMap<ProfileStatisticsName, ProfileDesc>>,
}

info!(
Expand Down

0 comments on commit 44dd650

Please sign in to comment.