use of org.apache.flink.table.planner.functions.utils.HiveTableSqlFunction in project flink by apache.
the class FunctionCatalogOperatorTable method convertToSqlFunction.
private Optional<SqlFunction> convertToSqlFunction(@Nullable SqlFunctionCategory category, ContextResolvedFunction resolvedFunction) {
final FunctionDefinition definition = resolvedFunction.getDefinition();
final FunctionIdentifier identifier = resolvedFunction.getIdentifier().orElse(null);
// legacy
if (definition instanceof AggregateFunctionDefinition) {
AggregateFunctionDefinition def = (AggregateFunctionDefinition) definition;
if (isHiveFunc(def.getAggregateFunction())) {
return Optional.of(new HiveAggSqlFunction(identifier, def.getAggregateFunction(), typeFactory));
} else {
return convertAggregateFunction(identifier, (AggregateFunctionDefinition) definition);
}
} else if (definition instanceof ScalarFunctionDefinition) {
ScalarFunctionDefinition def = (ScalarFunctionDefinition) definition;
return convertScalarFunction(identifier, def);
} else if (definition instanceof TableFunctionDefinition && category != null && category.isTableFunction()) {
TableFunctionDefinition def = (TableFunctionDefinition) definition;
if (isHiveFunc(def.getTableFunction())) {
DataType returnType = fromLegacyInfoToDataType(new GenericTypeInfo<>(Row.class));
return Optional.of(new HiveTableSqlFunction(identifier, def.getTableFunction(), returnType, typeFactory, new DeferredTypeFlinkTableFunction(def.getTableFunction(), returnType), HiveTableSqlFunction.operandTypeChecker(identifier.toString(), def.getTableFunction())));
} else {
return convertTableFunction(identifier, (TableFunctionDefinition) definition);
}
}
// new stack
return convertToBridgingSqlFunction(category, resolvedFunction);
}
Aggregations