Skip to main content

plan_sorted_merge

Function plan_sorted_merge 

Source
pub async fn plan_sorted_merge(
    ctx: &SessionContext,
    query: &str,
    columns: &[ScanSortColumn],
    insert_range: TimeRange,
) -> Result<PlannedSortedMerge, Error>
Expand description

Builds the PerFile k-way merge plan: four optimizer settings keep the merge a bounded-memory streaming k-way merge instead of fanning out to target_partitions – repartition_file_scans = false is the fifth, applied to every merge by the caller’s make_merge_session_context session rather than set here – an unconditional logical-plan DataFrame::sort makes the declared ordering a property of the query plan rather than of an optimizer preference (so a wrong or missing merge-query sort is not representable), and three checks – two hard, one reported through ordering_honored – run against the physical plan. Shared by the daemon’s merge and the admin streaming check so the two cannot drift.