davecromberge commented on code in PR #14625:
URL: https://github.com/apache/pinot/pull/14625#discussion_r1886407466


##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/aggregator/DistinctCountThetaSketchAggregator.java:
##########
@@ -33,20 +34,26 @@ public DistinctCountThetaSketchAggregator() {
 
   @Override
   public Object aggregate(Object value1, Object value2, Map<String, String> 
functionParameters) {
-    String nominalEntriesParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_NOMINAL_ENTRIES);
+    SetOperationBuilder unionBuilder = Union.builder();
 
-    int sketchNominalEntries;
+    String samplingProbabilityParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_SAMPLING_PROBABILITY);
+    String nominalEntriesParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_NOMINAL_ENTRIES);
 
-    // Check if nominal entries values match
+    // Check if nominal entries is set
     if (nominalEntriesParam != null) {
-      sketchNominalEntries = Integer.parseInt(nominalEntriesParam);
+      unionBuilder.setNominalEntries(Integer.parseInt(nominalEntriesParam));
     } else {
       // If the functionParameters don't have an explicit nominal entries 
value set,
       // use the default value for nominal entries
-      sketchNominalEntries = 
CommonConstants.Helix.DEFAULT_THETA_SKETCH_NOMINAL_ENTRIES;
+      
unionBuilder.setNominalEntries(CommonConstants.Helix.DEFAULT_THETA_SKETCH_NOMINAL_ENTRIES);
+    }
+
+    // Check if sampling probability is set
+    if (samplingProbabilityParam != null) {
+      unionBuilder.setP(Float.parseFloat(samplingProbabilityParam));

Review Comment:
   Yes, if it is omitted the default will be used.  The default is 1.0 - no 
sampling.



##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/aggregator/DistinctCountThetaSketchAggregator.java:
##########
@@ -33,20 +34,26 @@ public DistinctCountThetaSketchAggregator() {
 
   @Override
   public Object aggregate(Object value1, Object value2, Map<String, String> 
functionParameters) {
-    String nominalEntriesParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_NOMINAL_ENTRIES);
+    SetOperationBuilder unionBuilder = Union.builder();
 
-    int sketchNominalEntries;
+    String samplingProbabilityParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_SAMPLING_PROBABILITY);
+    String nominalEntriesParam = 
functionParameters.get(Constants.THETA_TUPLE_SKETCH_NOMINAL_ENTRIES);
 
-    // Check if nominal entries values match
+    // Check if nominal entries is set
     if (nominalEntriesParam != null) {
-      sketchNominalEntries = Integer.parseInt(nominalEntriesParam);
+      unionBuilder.setNominalEntries(Integer.parseInt(nominalEntriesParam));
     } else {
       // If the functionParameters don't have an explicit nominal entries 
value set,
       // use the default value for nominal entries
-      sketchNominalEntries = 
CommonConstants.Helix.DEFAULT_THETA_SKETCH_NOMINAL_ENTRIES;
+      
unionBuilder.setNominalEntries(CommonConstants.Helix.DEFAULT_THETA_SKETCH_NOMINAL_ENTRIES);
+    }
+
+    // Check if sampling probability is set
+    if (samplingProbabilityParam != null) {
+      unionBuilder.setP(Float.parseFloat(samplingProbabilityParam));

Review Comment:
   Yes, if it is omitted the default will implicitly be used.  The default is 
1.0 - no sampling.



-- 
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: commits-unsubscr...@pinot.apache.org

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