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

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/functions/HiveMergeablAggregate.java
 ##########
 @@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.optimizer.calcite.functions;
+
+import org.apache.calcite.sql.SqlAggFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.SqlOperandTypeChecker;
+import org.apache.calcite.sql.type.SqlOperandTypeInference;
+import org.apache.calcite.sql.type.SqlReturnTypeInference;
+
+/**
+ * Mergeable aggregate.
+ *
+ * A mergeable aggregate is:
+ * - accepts the same kind as inputs as the output (an X^n -> X function)
+ *
+ * Example: the SUM function is a great example; since SUM of SUM -s is the 
overall sum.
+ */
+public class HiveMergeablAggregate extends SqlAggFunction  {
 
 Review comment:
   That interface is quite wide; we might be able to utilize it - but to do 
that we should also implement functions like `singleton` (calculate the agg for 
a single value) which is trivial for a `COUNT` or a `SUM` (the interface is 
only implemented for things like these right now) ; but for a more complicated 
thing - like a sketch function it should involve executing the actual function 
to fold the single value.
   
   I think it would be better to have a set of smaller interfaces - instead of 
one bigger; that could make it easier to implement the most valuable ones for a 
given usecase; when the others are not neccessarily needed.
   
   This could be probably extended to support the `SqlSplittableAggFunction` 
interface - but as you can see there will be some challenges along the way ; so 
if we want to do that - I think it should at least have it's own ticket.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to