fx19880617 commented on a change in pull request #6118:
URL: https://github.com/apache/incubator-pinot/pull/6118#discussion_r501454793



##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/BloomFilterConfig.java
##########
@@ -16,38 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.core.bloom;
+package org.apache.pinot.spi.config.table;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.pinot.spi.config.BaseJsonConfig;
 
 
-/**
- * Enum for bloom filter type
- */
-public enum BloomFilterType {
-  // NOTE: Do not change the value of bloom filter type when adding a new type 
since we are writing/checking type value
-  // when serializing/deserializing a bloom filter
-  GUAVA_ON_HEAP(1);
-
-  private int _value;
-  private static Map<Integer, BloomFilterType> _bloomFilterTypeMap = new 
HashMap<>();
+public class BloomFilterConfig extends BaseJsonConfig {
+  public static final double DEFAULT_FPP = 0.05;
 
-  BloomFilterType(int value) {
-    _value = value;
-  }
-
-  static {
-    for (BloomFilterType pageType : BloomFilterType.values()) {
-      _bloomFilterTypeMap.put(pageType._value, pageType);
-    }
-  }
+  private final double _fpp;
 
-  public static BloomFilterType valueOf(int pageType) {
-    return _bloomFilterTypeMap.get(pageType);
+  @JsonCreator
+  public BloomFilterConfig(@JsonProperty(value = "fpp", required = true) 
double fpp) {
+    Preconditions.checkArgument(fpp > 0.0 && fpp < 1.0, "Invalid fpp (false 
positive probability): %s", fpp);

Review comment:
       %d 

##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/BloomFilterConfig.java
##########
@@ -16,38 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.core.bloom;
+package org.apache.pinot.spi.config.table;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import org.apache.pinot.spi.config.BaseJsonConfig;
 
 
-/**
- * Enum for bloom filter type
- */
-public enum BloomFilterType {
-  // NOTE: Do not change the value of bloom filter type when adding a new type 
since we are writing/checking type value
-  // when serializing/deserializing a bloom filter
-  GUAVA_ON_HEAP(1);
-
-  private int _value;
-  private static Map<Integer, BloomFilterType> _bloomFilterTypeMap = new 
HashMap<>();
+public class BloomFilterConfig extends BaseJsonConfig {
+  public static final double DEFAULT_FPP = 0.05;
 
-  BloomFilterType(int value) {
-    _value = value;
-  }
-
-  static {
-    for (BloomFilterType pageType : BloomFilterType.values()) {
-      _bloomFilterTypeMap.put(pageType._value, pageType);
-    }
-  }
+  private final double _fpp;
 
-  public static BloomFilterType valueOf(int pageType) {
-    return _bloomFilterTypeMap.get(pageType);
+  @JsonCreator
+  public BloomFilterConfig(@JsonProperty(value = "fpp", required = true) 
double fpp) {
+    Preconditions.checkArgument(fpp > 0.0 && fpp < 1.0, "Invalid fpp (false 
positive probability): %s", fpp);

Review comment:
       %f




----------------------------------------------------------------
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