gortiz commented on code in PR #18648:
URL: https://github.com/apache/pinot/pull/18648#discussion_r3341703775
##########
pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNativeV2.java:
##########
@@ -163,6 +167,34 @@ public void mergeNumGroupsWarningLimitReached(boolean
numGroupsWarningLimitReach
_brokerStats.merge(StatKey.NUM_GROUPS_WARNING_LIMIT_REACHED,
numGroupsWarningLimitReached);
}
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ public List<String> getEarlyTerminationReasons() {
+ String earlyTerminationReasons =
_brokerStats.getString(StatKey.EARLY_TERMINATION_REASONS);
+ LinkedHashSet<String> reasons = new LinkedHashSet<>();
+ addEarlyTerminationReasons(earlyTerminationReasons, reasons);
+ return List.copyOf(reasons);
+ }
+
+ public static String mergeEarlyTerminationReasons(@Nullable String
earlyTerminationReasons1,
+ @Nullable String earlyTerminationReasons2) {
+ LinkedHashSet<String> mergedReasons = new LinkedHashSet<>();
+ addEarlyTerminationReasons(earlyTerminationReasons1, mergedReasons);
+ addEarlyTerminationReasons(earlyTerminationReasons2, mergedReasons);
+ return mergedReasons.isEmpty() ? null :
String.join(EARLY_TERMINATION_REASON_SEPARATOR, mergedReasons);
+ }
+
+ private static void addEarlyTerminationReasons(@Nullable String
earlyTerminationReasons,
+ LinkedHashSet<String> mergedReasons) {
+ if (earlyTerminationReasons == null || earlyTerminationReasons.isEmpty()) {
+ return;
+ }
+ for (String earlyTerminationReason :
earlyTerminationReasons.split(EARLY_TERMINATION_REASON_SEPARATOR)) {
Review Comment:
this is unecessary expensive. We don't need to allocate a String[] for this.
--
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]