manish-m-pillai commented on code in PR #3733:
URL: https://github.com/apache/cassandra/pull/3733#discussion_r1883781629


##########
src/java/org/apache/cassandra/tools/nodetool/Status.java:
##########
@@ -170,24 +215,134 @@ private void addNode(String endpoint, Float owns, 
HostStatWithPort hostStat, int
         strOwns = owns != null && hasEffectiveOwns ? new 
DecimalFormat("##0.0%").format(owns) : "?";
         hostID = hostIDMap.get(endpoint);
 
-        try
-        {
+        try {
             rack = epSnitchInfo.getRack(endpoint);
-        }
-        catch (UnknownHostException e)
-        {
+        } catch (UnknownHostException e) {
             throw new RuntimeException(e);
         }
 
-        epDns = hostStat.ipOrDns(printPort);
         if (isTokenPerNode)
-        {
-            tableBuilder.add(statusAndState, epDns, load, strOwns, hostID, 
hostStat.token, rack);
-        }
+            return List.of(addressAndPort, statusAndState, epDns, load, 
strOwns, hostID, hostStat.token, rack);
         else
-        {
-            tableBuilder.add(statusAndState, epDns, load, 
String.valueOf(size), strOwns, hostID, rack);
+            return List.of(addressAndPort, statusAndState, epDns, load, 
String.valueOf(size), strOwns, hostID, rack);
+    }
+
+    // To check for descending order
+    private Boolean desc() {
+        return sortOrder == null ? null : sortOrder == SortOrder.desc;
+    }
+
+    // Sort function to sort the data
+    private Map<String, List<Object>> sort(Map<String, List<Object>> map) {
+        switch (sortBy) {
+            case none:
+                return map;
+            case ip:
+                return sortByIp(map, 0, desc() != null ? desc() : false);

Review Comment:
   I will update the changes accordingly as you suggested



-- 
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