jcamachor commented on a change in pull request #960: HIVE-23030 ds rollup union
URL: https://github.com/apache/hive/pull/960#discussion_r399347796
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/DataSketchesFunctions.java
 ##########
 @@ -53,169 +73,278 @@
   private static final String SKETCH_TO_VARIANCES = "variances";
   private static final String SKETCH_TO_PERCENTILE = "percentile";
 
-  private final Registry system;
+  private final List<SketchDescriptor> sketchClasses;
+  private final ArrayList<UDFDescriptor> descriptors;
+
+  DataSketchesFunctions() {
+    this.sketchClasses = new ArrayList<SketchDescriptor>();
+    this.descriptors = new ArrayList<HiveUDFPlugin.UDFDescriptor>();
+    registerHll();
+    registerCpc();
+    registerKll();
+    registerTheta();
+    registerTuple();
+    registerQuantiles();
+    registerFrequencies();
+
+    buildCalciteFns();
+    buildDescritors();
+  }
+
+  @Override
+  public Iterable<UDFDescriptor> getDescriptors() {
+    return descriptors;
+  }
 
-  public DataSketchesFunctions(Registry system) {
-    this.system = system;
+  private void buildDescritors() {
+    for (SketchDescriptor sketchDescriptor : sketchClasses) {
+      descriptors.addAll(sketchDescriptor.fnMap.values());
+    }
   }
 
-  public static void register(Registry system) {
-    DataSketchesFunctions dsf = new DataSketchesFunctions(system);
-    String prefix = "ds";
-    dsf.registerHll(prefix);
-    dsf.registerCpc(prefix);
-    dsf.registerKll(prefix);
-    dsf.registerTheta(prefix);
-    dsf.registerTuple(prefix);
-    dsf.registerQuantiles(prefix);
-    dsf.registerFrequencies(prefix);
+  private void buildCalciteFns() {
+    for (SketchDescriptor sd : sketchClasses) {
+      // Mergability is exposed to Calcite; which enables to use it during 
rollup.
+
 
 Review comment:
   nit. \n

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


With regards,
Apache Git Services

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

Reply via email to