You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/25 20:09:55 UTC

[GitHub] [incubator-druid] esevastyanov commented on a change in pull request #8157: Enum of ResponseContext keys

esevastyanov commented on a change in pull request #8157: Enum of ResponseContext keys
URL: https://github.com/apache/incubator-druid/pull/8157#discussion_r307479130
 
 

 ##########
 File path: processing/src/main/java/org/apache/druid/query/context/ResponseContext.java
 ##########
 @@ -21,51 +21,113 @@
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Preconditions;
 import org.apache.druid.guice.annotations.PublicApi;
+import org.apache.druid.java.util.common.Pair;
 import org.apache.druid.java.util.common.jackson.JacksonUtils;
+import org.apache.druid.query.SegmentDescriptor;
+import org.joda.time.Interval;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.PriorityQueue;
+import java.util.function.BiFunction;
 
 /**
  * The context for storing and passing data between chains of {@link org.apache.druid.query.QueryRunner}s.
  * The context is also transferred between Druid nodes with all the data it contains.
- * All the keys associated with data inside the context should be stored here.
- * CTX_* keys might be aggregated into an enum. Consider refactoring that.
  */
 @PublicApi
 public abstract class ResponseContext
 {
   /**
-   * Lists intervals for which NO segment is present.
+   * Keys associated with objects in the context.
    */
-  public static final String CTX_UNCOVERED_INTERVALS = "uncoveredIntervals";
-  /**
-   * Indicates if the number of uncovered intervals exceeded the limit (true/false).
-   */
-  public static final String CTX_UNCOVERED_INTERVALS_OVERFLOWED = "uncoveredIntervalsOverflowed";
-  /**
-   * Lists missing segments.
-   */
-  public static final String CTX_MISSING_SEGMENTS = "missingSegments";
-  /**
-   * Entity tag. A part of HTTP cache validation mechanism.
-   * Is being removed from the context before sending and used as a separate HTTP header.
-   */
-  public static final String CTX_ETAG = "ETag";
-  /**
-   * Query total bytes gathered.
-   */
-  public static final String CTX_QUERY_TOTAL_BYTES_GATHERED = "queryTotalBytesGathered";
-  /**
-   * This variable indicates when a running query should be expired,
-   * and is effective only when 'timeout' of queryContext has a positive value.
-   */
-  public static final String CTX_TIMEOUT_AT = "timeoutAt";
-  /**
-   * The number of scanned rows.
-   */
-  public static final String CTX_COUNT = "count";
+  public enum Key
+  {
+    /**
+     * Lists intervals for which NO segment is present.
+     */
+    UNCOVERED_INTERVALS(
+        "uncoveredIntervals",
+            (oldValue, newValue) -> {
 
 Review comment:
   Right, we need to fix checkstyle config

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org