Akshat-Jain commented on code in PR #16420:
URL: https://github.com/apache/druid/pull/16420#discussion_r1599449769
##########
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java:
##########
@@ -94,19 +95,34 @@ public static LookupLoadingSpec
createFromContext(Map<String, Object> context, L
return defaultSpec;
}
- final Object lookupModeValue =
context.get(LookupLoadingSpec.CTX_LOOKUP_LOADING_MODE);
+ final Object lookupModeValue = context.get(CTX_LOOKUP_LOADING_MODE);
if (lookupModeValue == null) {
return defaultSpec;
}
- final LookupLoadingSpec.Mode lookupLoadingMode =
LookupLoadingSpec.Mode.valueOf(lookupModeValue.toString());
+ final LookupLoadingSpec.Mode lookupLoadingMode;
+ try {
+ lookupLoadingMode =
LookupLoadingSpec.Mode.valueOf(lookupModeValue.toString());
+ }
+ catch (IllegalArgumentException e) {
+ throw InvalidInput.exception("Invalid value of %s[%s]. Allowed values
are %s",
+ CTX_LOOKUP_LOADING_MODE,
lookupModeValue.toString(), Arrays.asList(LookupLoadingSpec.Mode.values()));
+ }
+
+ if (lookupLoadingMode == Mode.NONE) {
+ return NONE;
+ } else if (lookupLoadingMode == Mode.ALL) {
+ return ALL;
+ } else if (lookupLoadingMode == Mode.ONLY_REQUIRED) {
+ Collection<String> lookupsToLoad;
+ try {
+ lookupsToLoad = (Collection<String>) context.get(CTX_LOOKUPS_TO_LOAD);
+ }
+ catch (ClassCastException e) {
+ throw InvalidInput.exception("Invalid value of %s[%s]. Please provide
a comma-separated list of lookup names.",
Review Comment:
Added.
--
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]