fn chunks_dedup_sort_key(
        output_sort_key: &Option<SortKey>,
        chunks: &Vec<Arc<dyn QueryChunk>>,
        dedup_sort_key_for_unsorted_chunks: &SortKey,
    ) -> SortKey {
        let chunks_dedup_sort_key = match &output_sort_key {
            // Use output _sort_key if provided
            Some(sort_key) => sort_key.clone(),
            None => {
                // Use the chunk's partition key if they were persisted chunks
                if let Some(sort_key) = if chunks.len() == 1 {
                    chunks[0].sort_key()
                } else {
                    Self::sort_key_of_overlapped_chunks(chunks)
                } {
                    sort_key.clone()
                } else {
                    // This happens either:
                    //   . In the Ingester to compact ingesting data that is not sorted and not
                    //     deduplicated yet
                    //   . In the Querier that also includes data sent from Ingester that is also
                    //     not yet sorted.
                    //        Note: Data sent from Ingester is already deduplicated but if it
                    //        overlaps with other chunks, it may include duplicated data with those
                    //        chunks
                    debug!(
                        "Sort key is computed during planning for deduplicating overlapped chunks."
                    );
                    dedup_sort_key_for_unsorted_chunks.clone()
                }
            }
        };
        chunks_dedup_sort_key
    }
// Return sort key for overlapped chunks
Return sort key for overlapped chunks
Return sort key for overlapped chunks
fn chunks_dedup_sort_key(
        output_sort_key: &Option<SortKey>,
        chunks: &Vec<Arc<dyn QueryChunk>>,
        dedup_sort_key_for_unsorted_chunks: &SortKey,
    ) -> SortKey {
        let chunks_dedup_sort_key = match &output_sort_key {
            // Use output _sort_key if provided
            Some(sort_key) => sort_key.clone(),
            None => {
                // Use the chunk's partition key if they were persisted chunks
                if let Some(sort_key) = if chunks.len() == 1 {
                    chunks[0].sort_key()
                } else {
                    Self::sort_key_of_overlapped_chunks(chunks)
                } {
                    sort_key.clone()
                } else {
                    // This happens either:
                    //   . In the Ingester to compact ingesting data that is not sorted and not
                    //     deduplicated yet
                    //   . In the Querier that also includes data sent from Ingester that is also
                    //     not yet sorted.
                    //        Note: Data sent from Ingester is already deduplicated but if it
                    //        overlaps with other chunks, it may include duplicated data with those
                    //        chunks
                    debug!(
                        "Sort key is computed during planning for deduplicating overlapped chunks."
                    );
                    dedup_sort_key_for_unsorted_chunks.clone()
                }
            }
        };
        chunks_dedup_sort_key
    }
fn chunks_dedup_sort_key ( output_sort_key : & Option < SortKey > , chunks : & Vec < Arc < dyn QueryChunk > > , dedup_sort_key_for_unsorted_chunks : & SortKey , ) -> SortKey { let chunks_dedup_sort_key = match & output_sort_key { // Use output _sort_key if provided Some ( sort_key ) => sort_key . clone ( ) , None => { // Use the chunk's partition key if they were persisted chunks if let Some ( sort_key ) = if chunks . len ( ) == 1 { chunks [ 0 ] . sort_key ( ) } else { Self :: sort_key_of_overlapped_chunks ( chunks ) } { sort_key . clone ( ) } else { // This happens either: //   . In the Ingester to compact ingesting data that is not sorted and not //     deduplicated yet //   . In the Querier that also includes data sent from Ingester that is also //     not yet sorted. //        Note: Data sent from Ingester is already deduplicated but if it //        overlaps with other chunks, it may include duplicated data with those //        chunks debug ! ( " " ) ; dedup_sort_key_for_unsorted_chunks . clone ( ) } } } ; chunks_dedup_sort_key }
Return sort key for overlapped chunks
Return sort key for overlapped chunks
output_sort_key
&Option<SortKey>
chunks
&Vec<Arc<dyn QueryChunk>>
dedup_sort_key_for_unsorted_chunks
&SortKey
output_sort_key
&Option<SortKey>
chunks
&Vec<Arc<dyn QueryChunk>>
dedup_sort_key_for_unsorted_chunks
&SortKey