Akshat-Jain commented on code in PR #16420:
URL: https://github.com/apache/druid/pull/16420#discussion_r1595045659
##########
server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java:
##########
@@ -80,6 +88,34 @@ public ImmutableSet<String> getLookupsToLoad()
return lookupsToLoad;
}
+ public static LookupLoadingSpec getSpecFromContext(Map<String, Object>
context, LookupLoadingSpec defaultSpec)
+ {
+ if (context == null) {
+ return defaultSpec;
+ }
+
+ final Object lookupModeValue =
context.get(LookupLoadingSpec.CTX_LOOKUP_LOADING_MODE);
+ if (lookupModeValue == null) {
+ return defaultSpec;
+ }
+
+ final LookupLoadingSpec.Mode lookupLoadingMode =
LookupLoadingSpec.Mode.valueOf(lookupModeValue.toString());
+
+ if (lookupLoadingMode == LookupLoadingSpec.Mode.NONE) {
+ return LookupLoadingSpec.NONE;
+ } else if (lookupLoadingMode == LookupLoadingSpec.Mode.ALL) {
+ return LookupLoadingSpec.ALL;
+ } else if (lookupLoadingMode == LookupLoadingSpec.Mode.ONLY_REQUIRED) {
+ Collection<String> lookupsToLoad = (Collection<String>)
context.get(LookupLoadingSpec.CTX_LOOKUPS_TO_LOAD);
+ if (lookupsToLoad == null || lookupsToLoad.isEmpty()) {
+ throw InvalidInput.exception("Set of lookups to load cannot be %s for
mode[ONLY_REQUIRED].", lookupsToLoad);
+ }
Review Comment:
Yes, technically it would work. But we decided to keep NONE and
ONLY_REQUIRED separate, please check past discussion on this point here:
https://github.com/apache/druid/pull/16358#discussion_r1593340894.
Hope this makes sense.
--
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]