GabrielCWT commented on code in PR #18547:
URL: https://github.com/apache/druid/pull/18547#discussion_r2375194469


##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -626,52 +631,64 @@ public Enumerable<Object[]> scan(DataContext root)
     /**
      * Returns a row for all node types which don't serve data. The returned 
row contains only static information.
      */
-    private static Object[] buildRowForNonDataServer(DiscoveryDruidNode 
discoveryDruidNode)
+    private Object[] buildRowForNonDataServer(DiscoveryDruidNode 
discoveryDruidNode)
     {
       final DruidNode node = discoveryDruidNode.getDruidNode();
-      return new Object[]{
-          node.getHostAndPortToUse(),
-          node.getHost(),
-          (long) node.getPlaintextPort(),
-          (long) node.getTlsPort(),
-          StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
-          null,
-          UNKNOWN_SIZE,
-          UNKNOWN_SIZE,
-          null,
-          toStringOrNull(discoveryDruidNode.getStartTime())
-      };
+      try {
+        return new Object[]{
+            node.getHostAndPortToUse(),
+            node.getHost(),
+            (long) node.getPlaintextPort(),
+            (long) node.getTlsPort(),
+            
StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
+            null,
+            UNKNOWN_SIZE,
+            UNKNOWN_SIZE,
+            null,
+            toStringOrNull(discoveryDruidNode.getStartTime()),
+            node.getLabels() == null ? null : 
jsonMapper.writeValueAsString(node.getLabels())
+        };
+      }
+      catch (JsonProcessingException e) {
+        throw new RuntimeException(e);
+      }
     }
 
     /**
      * Returns a row for all node types which don't serve data. The returned 
row contains only static information.
      */
-    private static Object[] buildRowForNonDataServerWithLeadership(
+    private Object[] buildRowForNonDataServerWithLeadership(
         DiscoveryDruidNode discoveryDruidNode,
         boolean isLeader
     )
     {
       final DruidNode node = discoveryDruidNode.getDruidNode();
-      return new Object[]{
-          node.getHostAndPortToUse(),
-          node.getHost(),
-          (long) node.getPlaintextPort(),
-          (long) node.getTlsPort(),
-          StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
-          null,
-          UNKNOWN_SIZE,
-          UNKNOWN_SIZE,
-          isLeader ? 1L : 0L,
-          toStringOrNull(discoveryDruidNode.getStartTime())
-      };
+      try {

Review Comment:
   Here is my initial implementation, let me know if you have any comments 
about it.
   
   ```
     public static String writeValueAsString(ObjectMapper jsonMapper, Object 
value) throws DruidException
     {
       try {
         return jsonMapper.writeValueAsString(value);
       }
       catch (JsonProcessingException e) {
         throw InvalidInput.exception(e, "Failed to serialize object as JSON");
       }
     }
     ``` 



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