[ 
https://issues.apache.org/jira/browse/HIVE-23030?focusedWorklogId=412189&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-412189
 ]

ASF GitHub Bot logged work on HIVE-23030:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Mar/20 08:26
            Start Date: 30/Mar/20 08:26
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on pull request #960: HIVE-23030 ds 
rollup union
URL: https://github.com/apache/hive/pull/960#discussion_r400011204
 
 

 ##########
 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.
+
+      RelProtoDataType sketchType = RelDataTypeImpl.proto(SqlTypeName.BINARY, 
true);
+
+      SketchFunctionDescriptor sketchSFD = sd.fnMap.get(DATA_TO_SKETCH);
+      SketchFunctionDescriptor unionSFD = sd.fnMap.get(UNION_SKETCH);
+
+      if (sketchSFD == null || unionSFD == null) {
+        continue;
+      }
+
+      HiveMergeablAggregate unionFn = new HiveMergeablAggregate(unionSFD.name,
 
 Review comment:
   good eye! I didn't noticed it at all :) 
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 412189)
    Time Spent: 4h 20m  (was: 4h 10m)

> Enable sketch union-s to be rolled up
> -------------------------------------
>
>                 Key: HIVE-23030
>                 URL: https://issues.apache.org/jira/browse/HIVE-23030
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23030.01.patch, HIVE-23030.02.patch, 
> HIVE-23030.03.patch, HIVE-23030.04.patch, HIVE-23030.04.patch
>
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> Enabling rolling up sketch aggregates could enable the matching of 
> materialized views created for higher dimensions to be applied for lower 
> dimension cases.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to