Skip to content

Show truncation indicator in array display#7072

Open
dimitarvdimitrov wants to merge 3 commits intodevelopfrom
mitko/display/truncation-indicator
Open

Show truncation indicator in array display#7072
dimitarvdimitrov wants to merge 3 commits intodevelopfrom
mitko/display/truncation-indicator

Conversation

@dimitarvdimitrov
Copy link
Contributor

When displaying array values that exceed the display limit (16), we now show ... at the end instead of silently truncating. Makes it obvious the output is incomplete.

@dimitarvdimitrov dimitarvdimitrov added changelog/skip Do not list PR in the changelog changelog/fix A bug fix and removed changelog/fix A bug fix labels Mar 19, 2026
@dimitarvdimitrov dimitarvdimitrov force-pushed the mitko/display/truncation-indicator branch from 6378a6d to 1c79cc4 Compare March 19, 2026 18:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates array value display so that when the displayed values are truncated (default limit 16), the output visibly indicates truncation by appending an ellipsis.

Changes:

  • Update scalar array display formatting to append ... when output is truncated.
  • Update DisplayOptions docs to mention the default truncation behavior.
  • Add a unit test asserting the new truncation indicator behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Dimitar Dimitrov <dimitar@spiraldb.com>
@dimitarvdimitrov dimitarvdimitrov force-pushed the mitko/display/truncation-indicator branch from 1c79cc4 to 0e2ed56 Compare March 19, 2026 18:13
@dimitarvdimitrov dimitarvdimitrov marked this pull request as ready for review March 19, 2026 18:21
Copy link
Contributor

@joseph-isaacs joseph-isaacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to add custom trunc len. but this can be a follow up

Copy link
Contributor

@joseph-isaacs joseph-isaacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to include the last few values too?

Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
Copy link
Contributor

I have added the logic to print trailer as well. We now print LIMIT - 3, ..., LAST 3 items when display is truncated

@robert3005 robert3005 enabled auto-merge (squash) March 20, 2026 05:35
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 20, 2026

Merging this PR will degrade performance by 15.51%

⚡ 2 improved benchmarks
❌ 2 regressed benchmarks
✅ 1012 untouched benchmarks
⏩ 1522 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation bench_many_nulls[0.9] 528.6 µs 463.3 µs +14.09%
Simulation bench_many_nulls[0.5] 360.5 µs 324.5 µs +11.11%
Simulation bitwise_not_vortex_buffer_mut[1024] 477.2 ns 535.6 ns -10.89%
Simulation bitwise_not_vortex_buffer_mut[128] 317.8 ns 376.1 ns -15.51%

Comparing mitko/display/truncation-indicator (aafad77) with develop (43ae2dc)

Open in CodSpeed

Footnotes

  1. 1522 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment on lines +483 to +507
let limit = self.len().min(f.precision().unwrap_or(DISPLAY_LIMIT));
let is_truncated = self.len() > limit;
write!(
f,
"{}",
(0..limit)
(0..(limit - if is_truncated { 3 } else { 0 }))
.map(|i| self
.scalar_at(i)
.map_or_else(|e| format!("<error: {e}>"), |s| s.to_string()))
.format(sep)
)?;
write!(f, "{}", if f.alternate() { "\n]" } else { "]" })
if is_truncated {
write!(f, "{sep}...{sep}")?;
write!(
f,
"{}",
(self.len() - 3..self.len())
.map(|i| self
.scalar_at(i)
.map_or_else(|e| format!("<error: {e}>"), |s| s.to_string()))
.format(sep)
)?;
}
let closing_brace = if f.alternate() { "\n]" } else { "]" };
write!(f, "{closing_brace}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we simplify this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/skip Do not list PR in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants