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