feat: first step to add delete_predicate into chunk catalog

pull/24376/head
Nga Tran 2021-08-30 17:16:08 -04:00
parent 2ff5a163ce
commit f962d0ef2e
2 changed files with 9 additions and 0 deletions

View File

@ -14,6 +14,7 @@ use metrics::{Counter, Histogram, KeyValue};
use mutable_buffer::chunk::{snapshot::ChunkSnapshot as MBChunkSnapshot, MBChunk}; use mutable_buffer::chunk::{snapshot::ChunkSnapshot as MBChunkSnapshot, MBChunk};
use observability_deps::tracing::debug; use observability_deps::tracing::debug;
use parquet_file::chunk::ParquetChunk; use parquet_file::chunk::ParquetChunk;
use query::predicate::Predicate;
use read_buffer::RBChunk; use read_buffer::RBChunk;
use snafu::Snafu; use snafu::Snafu;
use std::sync::Arc; use std::sync::Arc;
@ -74,6 +75,9 @@ pub struct ChunkMetadata {
/// The schema for the table in this Chunk /// The schema for the table in this Chunk
pub schema: Arc<Schema>, pub schema: Arc<Schema>,
/// Delete predicates of this chunk
pub delete_predicates: Arc<Vec<Predicate>>,
} }
/// Different memory representations of a frozen chunk. /// Different memory representations of a frozen chunk.
@ -305,6 +309,7 @@ impl CatalogChunk {
meta: Arc::new(ChunkMetadata { meta: Arc::new(ChunkMetadata {
table_summary: Arc::new(chunk.table_summary()), table_summary: Arc::new(chunk.table_summary()),
schema, schema,
delete_predicates: Arc::new(vec![]), //todo: consider to use the one of the given chunk if appropriate
}), }),
representation: ChunkStageFrozenRepr::ReadBuffer(Arc::new(chunk)), representation: ChunkStageFrozenRepr::ReadBuffer(Arc::new(chunk)),
}; };
@ -342,6 +347,7 @@ impl CatalogChunk {
let meta = Arc::new(ChunkMetadata { let meta = Arc::new(ChunkMetadata {
table_summary: Arc::clone(chunk.table_summary()), table_summary: Arc::clone(chunk.table_summary()),
schema: chunk.schema(), schema: chunk.schema(),
delete_predicates: Arc::new(vec![]), //todo: consider to use the one of the given chunk if appropriate
}); });
let stage = ChunkStage::Persisted { let stage = ChunkStage::Persisted {
@ -641,6 +647,7 @@ impl CatalogChunk {
let metadata = ChunkMetadata { let metadata = ChunkMetadata {
table_summary: Arc::new(mb_chunk.table_summary()), table_summary: Arc::new(mb_chunk.table_summary()),
schema: s.full_schema(), schema: s.full_schema(),
delete_predicates: Arc::new(vec![]), //todo: consider to use the one of the mb_chunk if appropriate
}; };
self.stage = ChunkStage::Frozen { self.stage = ChunkStage::Frozen {
@ -729,6 +736,7 @@ impl CatalogChunk {
*meta = Arc::new(ChunkMetadata { *meta = Arc::new(ChunkMetadata {
table_summary: Arc::clone(&meta.table_summary), table_summary: Arc::clone(&meta.table_summary),
schema, schema,
delete_predicates: Arc::new(vec![]), //todo: consider to use the one of the given chunk if appropriate
}); });
match &representation { match &representation {

View File

@ -117,6 +117,7 @@ impl DbChunk {
let meta = ChunkMetadata { let meta = ChunkMetadata {
table_summary: Arc::new(mb_chunk.table_summary()), table_summary: Arc::new(mb_chunk.table_summary()),
schema: snapshot.full_schema(), schema: snapshot.full_schema(),
delete_predicates: Arc::new(vec![]), //todo: consider to use the one of the given chunk if appropriate
}; };
(state, Arc::new(meta)) (state, Arc::new(meta))
} }