@@ -355,21 +355,9 @@ private void printSStableMetadata(String fname, boolean scan) throws IOException
355
355
if (validation != null && header != null )
356
356
printMinMaxToken (descriptor , FBUtilities .newPartitioner (descriptor ), header .getKeyType ());
357
357
358
- if (header != null && header .getClusteringTypes ().size () == stats .minClusteringValues .size ())
359
- {
360
- List <AbstractType <?>> clusteringTypes = header .getClusteringTypes ();
361
- List <ByteBuffer > minClusteringValues = stats .minClusteringValues ;
362
- List <ByteBuffer > maxClusteringValues = stats .maxClusteringValues ;
363
- String [] minValues = new String [clusteringTypes .size ()];
364
- String [] maxValues = new String [clusteringTypes .size ()];
365
- for (int i = 0 ; i < clusteringTypes .size (); i ++)
366
- {
367
- minValues [i ] = clusteringTypes .get (i ).getString (minClusteringValues .get (i ));
368
- maxValues [i ] = clusteringTypes .get (i ).getString (maxClusteringValues .get (i ));
369
- }
370
- field ("minClusteringValues" , Arrays .toString (minValues ));
371
- field ("maxClusteringValues" , Arrays .toString (maxValues ));
372
- }
358
+ printClusteringValues (header , "minClusteringValues" , stats .minClusteringValues );
359
+ printClusteringValues (header , "maxClusteringValues" , stats .maxClusteringValues );
360
+
373
361
field ("Estimated droppable tombstones" ,
374
362
stats .getEstimatedDroppableTombstoneRatio ((int ) (System .currentTimeMillis () / 1000 ) - this .gc ));
375
363
field ("SSTable Level" , stats .sstableLevel );
@@ -436,6 +424,21 @@ private void printSStableMetadata(String fname, boolean scan) throws IOException
436
424
}
437
425
}
438
426
427
+ private void printClusteringValues (SerializationHeader .Component header , String name , List <ByteBuffer > clusteringValues )
428
+ {
429
+ if (header != null && header .getClusteringTypes ().size () >= clusteringValues .size ())
430
+ {
431
+ List <AbstractType <?>> clusteringTypes = header .getClusteringTypes ();
432
+ int size = Math .min (clusteringTypes .size (), clusteringValues .size ());
433
+ String [] values = new String [size ];
434
+ for (int i = 0 ; i < size ; i ++)
435
+ {
436
+ values [i ] = clusteringTypes .get (i ).getString (clusteringValues .get (i ));
437
+ }
438
+ field (name , Arrays .toString (values ));
439
+ }
440
+ }
441
+
439
442
private void field (String field , Object value )
440
443
{
441
444
field (field , value , null );
0 commit comments