Jackie-Jiang commented on a change in pull request #7052:
URL: https://github.com/apache/incubator-pinot/pull/7052#discussion_r653803756



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptions.java
##########
@@ -41,15 +43,39 @@ public QueryOptions(@Nullable Map<String, String> 
queryOptions) {
       _responseFormatSQL = 
Request.SQL.equalsIgnoreCase(queryOptions.get(Request.QueryOptionKey.RESPONSE_FORMAT));
       _preserveType = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.PRESERVE_TYPE));
       _skipUpsert = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.SKIP_UPSERT));
+      _enableSegmentTrim = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.ENABLE_SEGMENT_TRIM));
+      _minSegmentTrimSize = 
Integer.parseInt(queryOptions.get(Request.QueryOptionKey.MIN_SEGMENT_TRIM_SIZE));
     } else {
       _timeoutMs = null;
       _groupByModeSQL = false;
       _responseFormatSQL = false;
       _preserveType = false;
       _skipUpsert = false;
+      _enableSegmentTrim = false;
+      _minSegmentTrimSize = -1;
     }
   }
 
+  @Nullable
+  public static Long getTimeoutMs(Map<String, String> queryOptions) {
+    String timeoutMsString = 
queryOptions.get(Request.QueryOptionKey.TIMEOUT_MS);
+    if (timeoutMsString != null) {
+      long timeoutMs = Long.parseLong(timeoutMsString);
+      Preconditions.checkState(timeoutMs > 0, "Query timeout must be positive, 
got: %s", timeoutMs);
+      return timeoutMs;
+    } else {
+      return null;
+    }
+  }
+
+  public static boolean getEnableSegmentTrim(Map<String, String> queryOptions) 
{

Review comment:
       ```suggestion
     public static boolean isEnableSegmentTrim(Map<String, String> 
queryOptions) {
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptions.java
##########
@@ -72,14 +98,12 @@ public boolean isSkipUpsert() {
   }
 
   @Nullable
-  public static Long getTimeoutMs(Map<String, String> queryOptions) {
-    String timeoutMsString = 
queryOptions.get(Request.QueryOptionKey.TIMEOUT_MS);
-    if (timeoutMsString != null) {
-      long timeoutMs = Long.parseLong(timeoutMsString);
-      Preconditions.checkState(timeoutMs > 0, "Query timeout must be positive, 
got: %s", timeoutMs);
-      return timeoutMs;
-    } else {
-      return null;
-    }
+  public Boolean isEnableSegmentTrim() {
+    return _enableSegmentTrim;
+  }
+
+  @Nullable
+  public Integer getMinSegmentTrimSize() {
+    return _minSegmentTrimSize;
   }
-}
+}

Review comment:
       (nit) new line

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptions.java
##########
@@ -41,15 +43,39 @@ public QueryOptions(@Nullable Map<String, String> 
queryOptions) {
       _responseFormatSQL = 
Request.SQL.equalsIgnoreCase(queryOptions.get(Request.QueryOptionKey.RESPONSE_FORMAT));
       _preserveType = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.PRESERVE_TYPE));
       _skipUpsert = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.SKIP_UPSERT));
+      _enableSegmentTrim = 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.ENABLE_SEGMENT_TRIM));
+      _minSegmentTrimSize = 
Integer.parseInt(queryOptions.get(Request.QueryOptionKey.MIN_SEGMENT_TRIM_SIZE));
     } else {
       _timeoutMs = null;
       _groupByModeSQL = false;
       _responseFormatSQL = false;
       _preserveType = false;
       _skipUpsert = false;
+      _enableSegmentTrim = false;
+      _minSegmentTrimSize = -1;
     }
   }
 
+  @Nullable
+  public static Long getTimeoutMs(Map<String, String> queryOptions) {
+    String timeoutMsString = 
queryOptions.get(Request.QueryOptionKey.TIMEOUT_MS);
+    if (timeoutMsString != null) {
+      long timeoutMs = Long.parseLong(timeoutMsString);
+      Preconditions.checkState(timeoutMs > 0, "Query timeout must be positive, 
got: %s", timeoutMs);
+      return timeoutMs;
+    } else {
+      return null;
+    }
+  }
+
+  public static boolean getEnableSegmentTrim(Map<String, String> queryOptions) 
{
+    return 
Boolean.parseBoolean(queryOptions.get(Request.QueryOptionKey.ENABLE_SEGMENT_TRIM));
+  }
+
+  public static int getSegmentTrimSize(Map<String, String> queryOptions) {

Review comment:
       ```suggestion
     public static int getMinSegmentTrimSize(Map<String, String> queryOptions) {
   ```

##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptions.java
##########
@@ -82,4 +98,24 @@ public static Long getTimeoutMs(Map<String, String> 
queryOptions) {
       return null;
     }
   }
+
+  @Nullable
+  public static Boolean getEnableSegmentTrim(Map<String, String> queryOptions) 
{
+    String enableSegmentTrim = 
queryOptions.get(Request.QueryOptionKey.SEGMENT_ENABLE_TRIM);
+    if (enableSegmentTrim != null) {
+      return Boolean.parseBoolean(enableSegmentTrim);
+    } else {
+      return null;
+    }
+  }

Review comment:
       While that's not the case. `Boolean.parseBoolean()` will never through 
NPE




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to