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


##########
pinot-core/src/main/java/org/apache/pinot/core/function/scalar/SketchFunctions.java:
##########
@@ -261,6 +261,11 @@ public static Sketch thetaSketchDiff(Object sketchObjectA, 
Object sketchObjectB)
     return diff.getResult(false, null, false);
   }
 
+  @ScalarFunction(names = {"thetaSketchToString", "theta_sketch_to_string"})
+  public static String thetaSketchToString(Object sketchObject) {

Review Comment:
   This function returns a string which is a summary of the current sketch 
state.  Note, the function name is consistent with the same name as that in 
Druid.  See [this 
link](https://druid.apache.org/docs/latest/development/extensions-core/datasketches-theta#sketch-summary).
   
   Examples include:
   
   ```
   ### HeapCompactOrderedSketch SUMMARY: 
      Estimate                : 149586.73149344584
      Upper Bound, 95% conf   : 154287.5017892762
      Lower Bound, 95% conf   : 145028.6046846571
      Theta (double)          : 0.027382107751846067
      Theta (long)            : 252555366948521403
      Theta (long) hex        : 038141c4a515c5bb
      EstMode?                : true
      Empty?                  : false
      Array Size Entries      : 4096
      Retained Entries        : 4096
      Seed Hash               : 93cc
   ### END SKETCH SUMMARY
   ```
   and:
   ```
   ### HeapCompactOrderedSketch SUMMARY: 
      Estimate                : 48249.113729035394
      Upper Bound, 95% conf   : 50358.736970106176
      Lower Bound, 95% conf   : 46227.35737896924
      Theta (double)          : 0.04377282475820978
      Theta (long)            : 403733047849016500
      Theta (long) hex        : 059a591165205cb4
      EstMode?                : true
      Empty?                  : false
      Array Size Entries      : 2112
      Retained Entries        : 2112
      Seed Hash               : 93cc
   ### END SKETCH SUMMARY
   ```
   
   These allow the end user to inspect whether a sketch is in estimation mode, 
or whether the sketch is ordered, or even the state of the sketch - whether 
undateable or compact.
   
   Where is the best place to include these examples for the commit notes?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to