/// discover overlaps and split them into three groups:
///  1. vector of vector of overlapped chunks
///  2. vector of non-overlapped chunks, each have duplicates in itself
///  3. vectors of non-overlapped chunks without duplicates
discover overlaps and split them into three groups:
1. vector of vector of overlapped chunks
2. vector of non-overlapped chunks, each have duplicates in itself
3. vectors of non-overlapped chunks without duplicates
discover overlaps and split them into three groups : 1 . vector of vector of overlapped chunks 2 . vector of non - overlapped chunks each have duplicates in itself 3 . vectors of non - overlapped chunks without duplicates
fn split_overlapped_chunks(&mut self, chunks: Vec<Arc<dyn QueryChunk>>) -> Result<()> {
        trace!("split_overlapped_chunks");
        // -------------------------------
        // Group chunks by partition first
        // Chunks in different partition are guarantee not to ovelap
        // Chunks without assigned partition id should be treated overlapped
        // This is the case of ingester data
        if chunks.iter().any(|c| c.partition_id().is_none()) {
            self.overlapped_chunks_set.push(chunks);
            return Ok(());
        }
        // Group chunks by partition
        let mut partition_groups = HashMap::with_capacity(chunks.len());
        for chunk in chunks {
            let chunks = partition_groups
                .entry(chunk.partition_id().expect("Chunk must have partition id"))
                .or_insert_with(Vec::new);
            chunks.push(chunk);
        }
        // -------------------------------
        // Find all overlapped groups for each partition-group based on their time range
        for (_, chunks) in partition_groups {
            let groups = group_potential_duplicates(chunks).context(InternalChunkGroupingSnafu)?;
            for mut group in groups {
                if group.len() == 1 {
                    if group[0].may_contain_pk_duplicates() {
                        self.in_chunk_duplicates_chunks.append(&mut group);
                    } else {
                        self.no_duplicates_chunks.append(&mut group);
                    }
                } else {
                    self.overlapped_chunks_set.push(group)
                }
            }
        }
        Ok(())
    }
fn split_overlapped_chunks ( & mut self , chunks : Vec < Arc < dyn QueryChunk > > ) -> Result < ( ) > { trace ! ( " " ) ; // ------------------------------- // Group chunks by partition first // Chunks in different partition are guarantee not to ovelap // Chunks without assigned partition id should be treated overlapped // This is the case of ingester data if chunks . iter ( ) . any ( | c | c . partition_id ( ) . is_none ( ) ) { self . overlapped_chunks_set . push ( chunks ) ; return Ok ( ( ) ) ; } // Group chunks by partition let mut partition_groups = HashMap :: with_capacity ( chunks . len ( ) ) ; for chunk in chunks { let chunks = partition_groups . entry ( chunk . partition_id ( ) . expect ( " " ) ) . or_insert_with ( Vec :: new ) ; chunks . push ( chunk ) ; } // ------------------------------- // Find all overlapped groups for each partition-group based on their time range for ( _ , chunks ) in partition_groups { let groups = group_potential_duplicates ( chunks ) . context ( InternalChunkGroupingSnafu ) ? ; for mut group in groups { if group . len ( ) == 1 { if group [ 0 ] . may_contain_pk_duplicates ( ) { self . in_chunk_duplicates_chunks . append ( & mut group ) ; } else { self . no_duplicates_chunks . append ( & mut group ) ; } } else { self . overlapped_chunks_set . push ( group ) } } } Ok ( ( ) ) }
discover overlaps and split them into three groups:
1. vector of vector of overlapped chunks
2. vector of non-overlapped chunks, each have duplicates in itself
3. vectors of non-overlapped chunks without duplicates
discover overlaps and split them into three groups : 1 . vector of vector of overlapped chunks 2 . vector of non - overlapped chunks each have duplicates in itself 3 . vectors of non - overlapped chunks without duplicates
&mut self
chunks
Vec<Arc<dyn QueryChunk>>