@@ -29,7 +29,7 @@ pub enum DisplayOptions {
2929 /// );
3030 /// ```
3131 MetadataOnly ,
32- /// Only the logical values of the array: `[0i16, 1i16, 2i16, 3i16, 4i16]`.
32+ /// Only the first 16 logical values of the array: `[0i16, 1i16, 2i16, 3i16, 4i16]`.
3333 ///
3434 /// ```
3535 /// # use vortex_array::display::DisplayOptions;
@@ -490,7 +490,8 @@ impl dyn DynArray + '_ {
490490 . map_or_else( |e| format!( "<error: {e}>" ) , |s| s. to_string( ) ) )
491491 . format( sep)
492492 ) ?;
493- write ! ( f, "{}" , if f. alternate( ) { "\n ]" } else { "]" } )
493+ let end = if self . len ( ) > limit { ", ...]" } else { "]" } ;
494+ write ! ( f, "{}{end}" , if f. alternate( ) { "\n " } else { "" } )
494495 }
495496 DisplayOptions :: TreeDisplay {
496497 buffers,
@@ -583,6 +584,7 @@ mod test {
583584 use crate :: arrays:: BoolArray ;
584585 use crate :: arrays:: ListArray ;
585586 use crate :: arrays:: StructArray ;
587+ use crate :: display:: DISPLAY_LIMIT ;
586588 use crate :: dtype:: FieldNames ;
587589 use crate :: validity:: Validity ;
588590
@@ -596,6 +598,15 @@ mod test {
596598
597599 let x = buffer ! [ 1 , 2 , 3 , 4 ] . into_array ( ) ;
598600 assert_eq ! ( x. display_values( ) . to_string( ) , "[1i32, 2i32, 3i32, 4i32]" ) ;
601+
602+ let x = crate :: arrays:: PrimitiveArray :: from_iter (
603+ 0i32 ..i32:: try_from ( DISPLAY_LIMIT ) . unwrap ( ) + 1 ,
604+ )
605+ . into_array ( ) ;
606+ assert_eq ! (
607+ x. display_values( ) . to_string( ) ,
608+ "[0i32, 1i32, 2i32, 3i32, 4i32, 5i32, 6i32, 7i32, 8i32, 9i32, 10i32, 11i32, 12i32, 13i32, 14i32, 15i32, ...]"
609+ ) ;
599610 }
600611
601612 #[ test]
0 commit comments