pub async fn write_thread_spans(
writer: &mut PerfettoWriter,
stream_id: &str,
data_stream: Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>,
) -> Result<(), Error>Expand description
Writes one thread’s spans, in row order, from its query result stream to the Perfetto writer.
begin is only guaranteed sorted within a single thread’s stream (different threads are
independent timelines), so the monotonicity tracker below is local to this call. It is the
runtime backstop for the ordering ThreadSpansView::get_scan_output_ordering declares to
DataFusion: once the redundant Sort node is elided, DataFusion trusts that declared ordering
and never re-validates it against the actual rows, so a violated invariant would otherwise
silently mis-order the exported trace. Errors instead of writing a row whose begin regresses.