// Return sort key of overlapped chunks
// The input chunks must be in the same partition
Return sort key of overlapped chunks
The input chunks must be in the same partition
Return sort key of overlapped chunks The input chunks must be in the same partition
fn sort_key_of_overlapped_chunks(chunks: &Vec<Arc<dyn QueryChunk>>) -> Option<&SortKey> {
        if chunks.is_empty() {
            return None;
        }
        // At least one of the overlapped chunks are not sorted
        // Either Ingesting data or data sent from Ingester to Querier will
        // fall into this case
        if chunks.iter().any(|c| c.sort_key() == None) {
            debug!("At least one of the overlapped chunks are not sorted");
            return None;
        }
        // All overlapped chunks must be sorted
        // --> they must come from persisted parquet files of the same partition
        // Get their partition's sort_key
        let partition_sort_key = chunks[0].partition_sort_key();
        // The chunk must have partition sort key
        let partition_sort_key =
            partition_sort_key.expect("Sorted/persisted chunk without partition id");
        // Verify if the partition sort key covers all columns of the chunks sort keys in the same order
        for c in chunks {
            let chunk_sort_key = c.sort_key().expect("Chunk should have sort key");
            if !Self::sort_key_cover_and_same_order(partition_sort_key, chunk_sort_key) {
                panic!(
                    "Partition sort key {} does not cover or is sorted on the same order of the chunk sort key {}",
                    partition_sort_key, chunk_sort_key
                );
            }
        }
        Some(partition_sort_key)
    }
fn sort_key_of_overlapped_chunks ( chunks : & Vec < Arc < dyn QueryChunk > > ) -> Option < & SortKey > { if chunks . is_empty ( ) { return None ; } // At least one of the overlapped chunks are not sorted // Either Ingesting data or data sent from Ingester to Querier will // fall into this case if chunks . iter ( ) . any ( | c | c . sort_key ( ) == None ) { debug ! ( " " ) ; return None ; } // All overlapped chunks must be sorted // --> they must come from persisted parquet files of the same partition // Get their partition's sort_key let partition_sort_key = chunks [ 0 ] . partition_sort_key ( ) ; // The chunk must have partition sort key let partition_sort_key = partition_sort_key . expect ( " " ) ; // Verify if the partition sort key covers all columns of the chunks sort keys in the same order for c in chunks { let chunk_sort_key = c . sort_key ( ) . expect ( " " ) ; if ! Self :: sort_key_cover_and_same_order ( partition_sort_key , chunk_sort_key ) { panic ! ( " " partition_sort_key chunk_sort_key ) ; } } Some ( partition_sort_key ) }
Return sort key of overlapped chunks
The input chunks must be in the same partition
Return sort key of overlapped chunks The input chunks must be in the same partition
chunks
&Vec<Arc<dyn QueryChunk>>