refactor(mito2): reduce duplicate IndexOutput struct (#4592)

* refactor(mito2): reduce duplicate IndexOutput struct

* docs(mito2): add index output note
This commit is contained in:
Ran Joe
2024-08-20 20:30:17 +08:00
committed by GitHub
parent 9d885fa0c2
commit 9db08dbbe0

View File

@@ -52,39 +52,27 @@ pub struct IndexOutput {
pub fulltext_index: FulltextIndexOutput,
}
/// Base output of the index creation.
#[derive(Debug, Clone, Default)]
pub struct IndexBaseOutput {
/// Size of the index.
pub index_size: ByteCount,
/// Number of rows in the index.
pub row_count: RowCount,
/// Available columns in the index.
pub columns: Vec<ColumnId>,
}
impl IndexBaseOutput {
pub fn is_available(&self) -> bool {
self.index_size > 0
}
}
/// Output of the inverted index creation.
#[derive(Debug, Clone, Default)]
pub struct InvertedIndexOutput {
/// Size of the index.
pub index_size: ByteCount,
/// Number of rows in the index.
pub row_count: RowCount,
/// Available columns in the index.
pub columns: Vec<ColumnId>,
}
pub type InvertedIndexOutput = IndexBaseOutput;
/// Output of the fulltext index creation.
#[derive(Debug, Clone, Default)]
pub struct FulltextIndexOutput {
/// Size of the index.
pub index_size: ByteCount,
/// Number of rows in the index.
pub row_count: RowCount,
/// Available columns in the index.
pub columns: Vec<ColumnId>,
}
impl InvertedIndexOutput {
pub fn is_available(&self) -> bool {
self.index_size > 0
}
}
impl FulltextIndexOutput {
pub fn is_available(&self) -> bool {
self.index_size > 0
}
}
pub type FulltextIndexOutput = IndexBaseOutput;
/// The index creator that hides the error handling details.
#[derive(Default)]