dianfu commented on a change in pull request #7209: [FLINK-10977][table] Add UnBounded FlatAggregate operator to streaming Table API URL: https://github.com/apache/flink/pull/7209#discussion_r241281005
########## File path: flink-libraries/flink-table-common/src/main/java/org/apache/flink/table/functions/TableAggregateFunction.java ########## @@ -0,0 +1,130 @@ +/* + * 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.flink.table.functions; + +import org.apache.flink.annotation.PublicEvolving; + +/** + * Base class for user-defined table aggregates. + * + * <p>The behavior of an {@link TableAggregateFunction} can be defined by implementing a series of custom + * methods. An {@link TableAggregateFunction} needs at least three methods: + * - <code>createAccumulator</code>, + * - <code>accumulate</code>, and + * - <code>emitValue</code> or <code>emitValueWithRetract</code>. + * + * <p>There are a few other methods that can be optional to have: + * - <code>retract</code>, + * - <code>merge</code>, and + * - <code>resetAccumulator</code>. + * + * <p>All these methods must be declared publicly, not static, and named exactly as the names + * mentioned above. The methods {@link #createAccumulator()} are defined in + * the {@link TableAggregateFunction} functions, while other methods are explained below. + * + * <pre> + * {@code + * Processes the input values and update the provided accumulator instance. The method + * accumulate can be overloaded with different custom types and arguments. A TableAggregateFunction + * requires at least one accumulate() method. + * + * param: accumulator the accumulator which contains the current aggregated results + * param: [user defined inputs] the input value (usually obtained from a new arrived data). + * + * public void accumulate(ACC accumulator, [user defined inputs]) + * } + * </pre> + * + * <pre> + * {@code + * Retracts the input values from the accumulator instance. The current design assumes the + * inputs are the values that have been previously accumulated. The method retract can be + * overloaded with different custom types and arguments. This function must be implemented for + * data stream bounded OVER aggregates. Review comment: TableAggregateFunction is not supported in OVER. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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