fix(fulltext-index): clean up 0-value timer (#4423)

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
This commit is contained in:
Zhenchi
2024-07-24 23:03:36 +08:00
committed by GitHub
parent e935bf7574
commit 91dbac4141
2 changed files with 6 additions and 11 deletions

View File

@@ -263,15 +263,13 @@ impl<'a> IndexerBuilder<'a> {
let err = match creator {
Ok(creator) => {
if creator.is_empty() {
if creator.is_none() {
debug!(
"Skip creating full-text index due to no columns require indexing, region_id: {}, file_id: {}",
self.metadata.region_id, self.file_id,
);
return None;
} else {
return Some(creator);
}
return creator;
}
Err(err) => err,
};

View File

@@ -57,7 +57,7 @@ impl FulltextIndexer {
metadata: &RegionMetadataRef,
compress: bool,
mem_limit: usize,
) -> Result<Self> {
) -> Result<Option<Self>> {
let mut creators = HashMap::new();
for column in &metadata.column_metadatas {
@@ -102,11 +102,11 @@ impl FulltextIndexer {
);
}
Ok(Self {
Ok((!creators.is_empty()).then(move || Self {
creators,
aborted: false,
stats: Statistics::new(TYPE_FULLTEXT_INDEX),
})
}))
}
/// Updates the index with the given batch.
@@ -167,10 +167,6 @@ impl FulltextIndexer {
pub fn column_ids(&self) -> impl Iterator<Item = ColumnId> + '_ {
self.creators.keys().copied()
}
pub(crate) fn is_empty(&self) -> bool {
self.creators.is_empty()
}
}
impl FulltextIndexer {
@@ -468,6 +464,7 @@ mod tests {
1024,
)
.await
.unwrap()
.unwrap();
let batch = new_batch(rows);