Search in sources :

Example 1 with ImperativeAggregateFunction

use of org.apache.flink.table.functions.ImperativeAggregateFunction in project flink by apache.

the class FunctionCatalog method registerTempSystemAggregateFunction.

/**
 * @deprecated Use {@link #registerTemporarySystemFunction(String, FunctionDefinition, boolean)}
 *     instead.
 */
@Deprecated
public <T, ACC> void registerTempSystemAggregateFunction(String name, ImperativeAggregateFunction<T, ACC> function, TypeInformation<T> resultType, TypeInformation<ACC> accType) {
    UserDefinedFunctionHelper.prepareInstance(config, function);
    final FunctionDefinition definition;
    if (function instanceof AggregateFunction) {
        definition = new AggregateFunctionDefinition(name, (AggregateFunction<?, ?>) function, resultType, accType);
    } else if (function instanceof TableAggregateFunction) {
        definition = new TableAggregateFunctionDefinition(name, (TableAggregateFunction<?, ?>) function, resultType, accType);
    } else {
        throw new TableException("Unknown function class: " + function.getClass());
    }
    registerTempSystemFunction(name, definition);
}
Also used : TableException(org.apache.flink.table.api.TableException) AggregateFunctionDefinition(org.apache.flink.table.functions.AggregateFunctionDefinition) TableAggregateFunctionDefinition(org.apache.flink.table.functions.TableAggregateFunctionDefinition) TableAggregateFunction(org.apache.flink.table.functions.TableAggregateFunction) TableAggregateFunctionDefinition(org.apache.flink.table.functions.TableAggregateFunctionDefinition) AggregateFunction(org.apache.flink.table.functions.AggregateFunction) TableAggregateFunction(org.apache.flink.table.functions.TableAggregateFunction) ImperativeAggregateFunction(org.apache.flink.table.functions.ImperativeAggregateFunction) AggregateFunctionDefinition(org.apache.flink.table.functions.AggregateFunctionDefinition) TableAggregateFunctionDefinition(org.apache.flink.table.functions.TableAggregateFunctionDefinition) TableFunctionDefinition(org.apache.flink.table.functions.TableFunctionDefinition) ScalarFunctionDefinition(org.apache.flink.table.functions.ScalarFunctionDefinition) FunctionDefinition(org.apache.flink.table.functions.FunctionDefinition)

Aggregations

TableException (org.apache.flink.table.api.TableException)1 AggregateFunction (org.apache.flink.table.functions.AggregateFunction)1 AggregateFunctionDefinition (org.apache.flink.table.functions.AggregateFunctionDefinition)1 FunctionDefinition (org.apache.flink.table.functions.FunctionDefinition)1 ImperativeAggregateFunction (org.apache.flink.table.functions.ImperativeAggregateFunction)1 ScalarFunctionDefinition (org.apache.flink.table.functions.ScalarFunctionDefinition)1 TableAggregateFunction (org.apache.flink.table.functions.TableAggregateFunction)1 TableAggregateFunctionDefinition (org.apache.flink.table.functions.TableAggregateFunctionDefinition)1 TableFunctionDefinition (org.apache.flink.table.functions.TableFunctionDefinition)1