[ https://issues.apache.org/jira/browse/HIVE-23030?focusedWorklogId=409384&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-409384 ]
ASF GitHub Bot logged work on HIVE-23030: ----------------------------------------- Author: ASF GitHub Bot Created on: 25/Mar/20 08:52 Start Date: 25/Mar/20 08:52 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_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 Issue Time Tracking ------------------- Worklog Id: (was: 409384) Time Spent: 2h (was: 1h 50m) > 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 > > Time Spent: 2h > 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)