Skip to main content

plan_sorted_extract

Function plan_sorted_extract 

Source
pub async fn plan_sorted_extract(
    df: DataFrame,
    sort_order: Option<&[ScanSortColumn]>,
    subject: &str,
    insert_range: TimeRange,
) -> Result<(Arc<dyn ExecutionPlan>, Arc<TaskContext>), Error>
Expand description

Applies sort_order (if declared) to df as a DataFrame::sort over its ScanSortColumns, builds the physical plan, and – only when a sort order was declared – runs assert_single_partition and assert_ordering_satisfied against it, mirroring QueryMerger::execute_sorted_merge‘s apply-then-plan sequence (merge.rs:227-270; its four merge-specific optimizer settings have no counterpart here). With sort_order: None the plan is built unsorted and neither assertion runs. subject names the query for the assertions’ error messages (e.g. format!("extract query for {view}")); insert_range is the range being written. Returns the physical plan and the TaskContext the caller needs to execute it – callers are left to execute_stream it themselves, since only they know what to do with the resulting stream.