ekaterinadimitrova2 commented on a change in pull request #1103:
URL: https://github.com/apache/cassandra/pull/1103#discussion_r666483401



##########
File path: src/java/org/apache/cassandra/tools/nodetool/CompactionHistory.java
##########
@@ -41,19 +46,79 @@ public void execute(NodeProbe probe)
         TabularData tabularData = probe.getCompactionHistory();
         if (tabularData.isEmpty())
         {
-            out.printf("There is no compaction history");
+            out.println("There is no compaction history");
             return;
         }
 
-        String format = "%-41s%-19s%-29s%-26s%-15s%-15s%s%n";
+        TableBuilder table = new TableBuilder();
         List<String> indexNames = tabularData.getTabularType().getIndexNames();
-        out.printf(format, toArray(indexNames, Object.class));
+        table.add(toArray(indexNames, String.class));
 
         Set<?> values = tabularData.keySet();
+        List<CompactionHistoryRow> chr = new ArrayList<>();
         for (Object eachValue : values)
         {
             List<?> value = (List<?>) eachValue;
-            out.printf(format, toArray(value, Object.class));
+            CompactionHistoryRow chc = new 
CompactionHistoryRow((String)value.get(0),
+                                                                
(String)value.get(1),
+                                                                
(String)value.get(2),
+                                                                
(Long)value.get(3),
+                                                                
(Long)value.get(4),
+                                                                
(Long)value.get(5),
+                                                                
(String)value.get(6));
+            chr.add(chc);
+        }
+        Collections.sort(chr);
+        for (CompactionHistoryRow eachChc : chr)
+        {
+            table.add(eachChc.getAllAsArray());
+        }
+        table.printTo(out);
+    }
+
+    /**
+     * Allows the Compaction History output to be ordered by 'compactedAt' - 
that is the
+     * time at which compaction finished.
+     */

Review comment:
       Not sure about this new order that we should introduce it here, I think 
this goes beyond the scope of what we wanted about the formatting




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to