GabrielCWT commented on code in PR #18547:
URL: https://github.com/apache/druid/pull/18547#discussion_r2370816788
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/SystemSchema.java:
##########
@@ -687,18 +704,24 @@ private static Object[] buildRowForDiscoverableDataServer(
} else {
currentSize = serverFromInventoryView.getCurrSize();
}
- return new Object[]{
- node.getHostAndPortToUse(),
- node.getHost(),
- (long) node.getPlaintextPort(),
- (long) node.getTlsPort(),
- StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
- druidServerToUse.getTier(),
- currentSize,
- druidServerToUse.getMaxSize(),
- null,
- toStringOrNull(discoveryDruidNode.getStartTime())
- };
+ try {
+ return new Object[]{
+ node.getHostAndPortToUse(),
+ node.getHost(),
+ (long) node.getPlaintextPort(),
+ (long) node.getTlsPort(),
+
StringUtils.toLowerCase(discoveryDruidNode.getNodeRole().toString()),
+ druidServerToUse.getTier(),
+ currentSize,
+ druidServerToUse.getMaxSize(),
+ null,
+ toStringOrNull(discoveryDruidNode.getStartTime()),
+ node.getLabels() == null ? null :
jsonMapper.writeValueAsString(node.getLabels())
Review Comment:
> This method returns an Object[] which can contain a map, why do we need to
serialize the labels using a jsonMapper at all?
When first implementing the feature, I saw that the nested objects returned
are in string format, I have followed this convention. I do agree that it would
be cleaner to return it in JSON format. If you are okay with it, I will update
it to return JSON instead of it being a string.
Side Note: Since we are returning it as a string, I suspect the Map's
`toString` method is being called under the hood and therefore the return
key-value is as follows `"labels": "{brokerTest=myValue,
brokerTest2=myValue2}"`.
--
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]