Formats byte counts with appropriate unit (e.g., 1.5 GB, 256 MB, 1.2 KB)
format_bytes_or_dash
(bytes: i64) -> String
Like format_bytes, but returns "-" if bytes is zero
format_records
(records: i64) -> String
Formats record counts with K/M/B suffixes
percentile
(sorted: &[f64], p: f64) -> f64
Computes percentile from a sorted slice
truncate
(s: &str, max: usize) -> String
Truncates a string to max characters, appending ... if truncated
sanitize_for_span
(s: &str) -> String
Replaces embedded newlines, carriage returns, and tabs with spaces. Ratatui’s Line/Span types expect no embedded newlines — they corrupt the differential renderer’s cursor position tracking
clean_stage_name
(name: &str) -> String
Removes Spark Connect prefixes and UUID suffixes from stage names for cleaner display
parse_plan_top_operations
(plan: &str, limit: usize) -> Vec<String>
Extracts the top N operations from a Spark SQL physical plan