diff --git a/crates/lance-csr/src/query.rs b/crates/lance-csr/src/query.rs index f809887..0f1ff3f 100644 --- a/crates/lance-csr/src/query.rs +++ b/crates/lance-csr/src/query.rs @@ -1271,11 +1271,16 @@ impl CypherQuery { ); rows.push(("physical_plan", df_physical_str)); - // Calculate column widths + // Calculate column widths. Lines wider than MAX_PLAN_WIDTH (long parameter + // values, such as a large `IN` list or a query vector) run past the right border + // instead of widening the column: padding every line to them made the output + // grow with lines × width. + const MAX_PLAN_WIDTH: usize = 1_000; let plan_type_width = rows.iter().map(|(t, _)| t.len()).max().unwrap_or(10); let plan_width = rows .iter() - .map(|(_, p)| p.lines().map(|l| l.len()).max().unwrap_or(0)) + .flat_map(|(_, p)| p.lines().map(|l| l.chars().count())) + .filter(|&w| w <= MAX_PLAN_WIDTH) .max() .unwrap_or(50); @@ -1285,52 +1290,27 @@ impl CypherQuery { "-".repeat(plan_type_width + 2), "-".repeat(plan_width + 2) ); + // Pad by hand: `{: = plan_content.lines().collect(); - if lines.is_empty() { - output.push_str(&format!( - "| {: