esevastyanov commented on a change in pull request #8157: Enum of
ResponseContext keys
URL: https://github.com/apache/incubator-druid/pull/8157#discussion_r307896474
##########
File path:
processing/src/main/java/org/apache/druid/query/context/ResponseContext.java
##########
@@ -76,56 +138,128 @@ public static ResponseContext createEmpty()
return DefaultResponseContext.createEmpty();
}
- protected abstract Map<String, Object> getDelegate();
-
- public Object put(String key, Object value)
+ public static ResponseContext deserialize(String responseContext,
ObjectMapper objectMapper) throws IOException
{
- return getDelegate().put(key, value);
+ final Map<String, Object> delegate = objectMapper.readValue(
+ responseContext,
+ JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT
+ );
+ return new ResponseContext()
+ {
+ @Override
+ protected Map<String, Object> getDelegate()
+ {
+ return delegate;
+ }
+ };
}
- public Object get(String key)
+ protected abstract Map<String, Object> getDelegate();
Review comment:
This requires updating SerDe (type reference and commenting that object
mapper should have enum support, considering we have custom value name) or
converting map keys to strings on serialization and back on deserialization.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]