Skip to content

Commit

Permalink
style: Histogram -> ColumnMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Jan 28, 2024
1 parent e17a0ab commit c88f25f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/execution/volcano/dml/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};

const DEFAULT_NUM_OF_BUCKETS: usize = 100;
const DEFAULT_HISTOGRAM_PATH: &'static str = "kipsql_histograms";
const DEFAULT_COLUMN_METAS_PATH: &'static str = "kipsql_column_metas";

pub struct Analyze {
table_name: TableName,
Expand Down Expand Up @@ -86,7 +86,7 @@ impl Analyze {
.as_secs();
let dir_path = dirs::config_dir()
.expect("Your system does not have a Config directory!")
.join(DEFAULT_HISTOGRAM_PATH)
.join(DEFAULT_COLUMN_METAS_PATH)
.join(table_name.as_str())
.join(ts.to_string());
fs::create_dir_all(&dir_path)?;
Expand All @@ -108,7 +108,7 @@ impl Analyze {
transaction.save_table_meta(&meta)?;

let columns: Vec<ColumnRef> = vec![Arc::new(ColumnCatalog::new_dummy(
"HISTOGRAM_PATH".to_string(),
"COLUMN_META_PATH".to_string(),
))];
let values = meta
.colum_meta_paths
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/core/column_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a, T: Transaction> ColumnMetaLoader<'a, T> {
return if let Some(column_metas) = option {
Ok(column_metas)
} else {
let paths = self.tx.histogram_paths(&table_name)?;
let paths = self.tx.column_meta_paths(&table_name)?;
let mut column_metas = Vec::with_capacity(paths.len());

for path in paths {
Expand Down
1 change: 1 addition & 0 deletions src/optimizer/core/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct Histogram {
values_len: usize,

buckets: Vec<Bucket>,
// TODO: How to use?
// Correlation is the statistical correlation between physical row ordering and logical ordering of
// the column values
correlation: f64,
Expand Down
2 changes: 1 addition & 1 deletion src/storage/kip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl Transaction for KipTransaction {
Ok(())
}

fn histogram_paths(&self, table_name: &str) -> Result<Vec<String>, StorageError> {
fn column_meta_paths(&self, table_name: &str) -> Result<Vec<String>, StorageError> {
if let Some(bytes) = self
.tx
.get(&TableCodec::encode_root_table_key(table_name))?
Expand Down
2 changes: 1 addition & 1 deletion src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub trait Transaction: Sync + Send + 'static {
fn table(&self, table_name: TableName) -> Option<&TableCatalog>;
fn table_metas(&self) -> Result<Vec<TableMeta>, StorageError>;
fn save_table_meta(&mut self, table_meta: &TableMeta) -> Result<(), StorageError>;
fn histogram_paths(&self, table_name: &str) -> Result<Vec<String>, StorageError>;
fn column_meta_paths(&self, table_name: &str) -> Result<Vec<String>, StorageError>;
fn meta_loader(&self) -> ColumnMetaLoader<Self>
where
Self: Sized;
Expand Down

0 comments on commit c88f25f

Please sign in to comment.