Search in sources :

Example 1 with SqlFunctionCategory

use of org.apache.calcite.sql.SqlFunctionCategory in project calcite by apache.

the class LookupOperatorOverloadsTest method testIsTableFunction.

@Test
public void testIsTableFunction() throws SQLException {
    List<SqlFunctionCategory> cats = new ArrayList<>();
    for (SqlFunctionCategory c : SqlFunctionCategory.values()) {
        if (c.isTableFunction()) {
            cats.add(c);
        }
    }
    check(cats, USER_DEFINED_TABLE_FUNCTION, USER_DEFINED_TABLE_SPECIFIC_FUNCTION, MATCH_RECOGNIZE);
}
Also used : SqlFunctionCategory(org.apache.calcite.sql.SqlFunctionCategory) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with SqlFunctionCategory

use of org.apache.calcite.sql.SqlFunctionCategory in project calcite by apache.

the class LookupOperatorOverloadsTest method testIsUserDefined.

@Test
public void testIsUserDefined() throws SQLException {
    List<SqlFunctionCategory> cats = new ArrayList<>();
    for (SqlFunctionCategory c : SqlFunctionCategory.values()) {
        if (c.isUserDefined()) {
            cats.add(c);
        }
    }
    check(cats, USER_DEFINED_FUNCTION, USER_DEFINED_PROCEDURE, USER_DEFINED_CONSTRUCTOR, USER_DEFINED_SPECIFIC_FUNCTION, USER_DEFINED_TABLE_FUNCTION, USER_DEFINED_TABLE_SPECIFIC_FUNCTION);
}
Also used : SqlFunctionCategory(org.apache.calcite.sql.SqlFunctionCategory) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with SqlFunctionCategory

use of org.apache.calcite.sql.SqlFunctionCategory in project calcite by apache.

the class LookupOperatorOverloadsTest method testIsUserDefinedNotSpecificFunction.

@Test
public void testIsUserDefinedNotSpecificFunction() throws SQLException {
    List<SqlFunctionCategory> cats = new ArrayList<>();
    for (SqlFunctionCategory sqlFunctionCategory : SqlFunctionCategory.values()) {
        if (sqlFunctionCategory.isUserDefinedNotSpecificFunction()) {
            cats.add(sqlFunctionCategory);
        }
    }
    check(cats, USER_DEFINED_FUNCTION, USER_DEFINED_TABLE_FUNCTION);
}
Also used : SqlFunctionCategory(org.apache.calcite.sql.SqlFunctionCategory) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with SqlFunctionCategory

use of org.apache.calcite.sql.SqlFunctionCategory in project calcite by apache.

the class LookupOperatorOverloadsTest method testIsSpecific.

@Test
public void testIsSpecific() throws SQLException {
    List<SqlFunctionCategory> cats = new ArrayList<>();
    for (SqlFunctionCategory c : SqlFunctionCategory.values()) {
        if (c.isSpecific()) {
            cats.add(c);
        }
    }
    check(cats, USER_DEFINED_SPECIFIC_FUNCTION, USER_DEFINED_TABLE_SPECIFIC_FUNCTION);
}
Also used : SqlFunctionCategory(org.apache.calcite.sql.SqlFunctionCategory) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 5 with SqlFunctionCategory

use of org.apache.calcite.sql.SqlFunctionCategory in project flink by apache.

the class FunctionCatalogOperatorTable method lookupOperatorOverloads.

@Override
public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList, SqlNameMatcher nameMatcher) {
    if (opName.isStar()) {
        return;
    }
    final UnresolvedIdentifier identifier = UnresolvedIdentifier.of(opName.names);
    functionCatalog.lookupFunction(identifier).flatMap(resolvedFunction -> convertToSqlFunction(category, resolvedFunction)).ifPresent(operatorList::add);
}
Also used : DataTypeFactory(org.apache.flink.table.catalog.DataTypeFactory) TypeInference(org.apache.flink.table.types.inference.TypeInference) SqlSyntax(org.apache.calcite.sql.SqlSyntax) DeferredTypeFlinkTableFunction(org.apache.flink.table.planner.plan.schema.DeferredTypeFlinkTableFunction) DataType(org.apache.flink.table.types.DataType) UnresolvedIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier) BuiltInFunctionDefinition(org.apache.flink.table.functions.BuiltInFunctionDefinition) AggregateFunctionDefinition(org.apache.flink.table.functions.AggregateFunctionDefinition) FunctionCatalog(org.apache.flink.table.catalog.FunctionCatalog) FlinkTypeFactory(org.apache.flink.table.planner.calcite.FlinkTypeFactory) SqlNameMatcher(org.apache.calcite.sql.validate.SqlNameMatcher) SqlIdentifier(org.apache.calcite.sql.SqlIdentifier) TypeConversions.fromLegacyInfoToDataType(org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType) SqlOperator(org.apache.calcite.sql.SqlOperator) FunctionKind(org.apache.flink.table.functions.FunctionKind) Nullable(javax.annotation.Nullable) TypeStrategies(org.apache.flink.table.types.inference.TypeStrategies) SqlKind(org.apache.calcite.sql.SqlKind) TableFunctionDefinition(org.apache.flink.table.functions.TableFunctionDefinition) ScalarFunctionDefinition(org.apache.flink.table.functions.ScalarFunctionDefinition) GenericTypeInfo(org.apache.flink.api.java.typeutils.GenericTypeInfo) FunctionDefinition(org.apache.flink.table.functions.FunctionDefinition) SqlOperatorTable(org.apache.calcite.sql.SqlOperatorTable) SqlFunctionCategory(org.apache.calcite.sql.SqlFunctionCategory) ContextResolvedFunction(org.apache.flink.table.catalog.ContextResolvedFunction) HiveAggSqlFunction(org.apache.flink.table.planner.functions.utils.HiveAggSqlFunction) List(java.util.List) SqlFunction(org.apache.calcite.sql.SqlFunction) BridgingSqlAggFunction(org.apache.flink.table.planner.functions.bridging.BridgingSqlAggFunction) BridgingSqlFunction(org.apache.flink.table.planner.functions.bridging.BridgingSqlFunction) ValidationException(org.apache.flink.table.api.ValidationException) Optional(java.util.Optional) HiveFunctionUtils.isHiveFunc(org.apache.flink.table.planner.functions.utils.HiveFunctionUtils.isHiveFunc) Internal(org.apache.flink.annotation.Internal) HiveTableSqlFunction(org.apache.flink.table.planner.functions.utils.HiveTableSqlFunction) UserDefinedFunctionUtils(org.apache.flink.table.planner.functions.utils.UserDefinedFunctionUtils) FunctionIdentifier(org.apache.flink.table.functions.FunctionIdentifier) TypeConversions(org.apache.flink.table.types.utils.TypeConversions) Row(org.apache.flink.types.Row) UnresolvedIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier)

Aggregations

SqlFunctionCategory (org.apache.calcite.sql.SqlFunctionCategory)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 List (java.util.List)1 Optional (java.util.Optional)1 Nullable (javax.annotation.Nullable)1 SqlFunction (org.apache.calcite.sql.SqlFunction)1 SqlIdentifier (org.apache.calcite.sql.SqlIdentifier)1 SqlKind (org.apache.calcite.sql.SqlKind)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1 SqlOperatorTable (org.apache.calcite.sql.SqlOperatorTable)1 SqlSyntax (org.apache.calcite.sql.SqlSyntax)1 SqlNameMatcher (org.apache.calcite.sql.validate.SqlNameMatcher)1 Internal (org.apache.flink.annotation.Internal)1 GenericTypeInfo (org.apache.flink.api.java.typeutils.GenericTypeInfo)1 ValidationException (org.apache.flink.table.api.ValidationException)1 ContextResolvedFunction (org.apache.flink.table.catalog.ContextResolvedFunction)1 DataTypeFactory (org.apache.flink.table.catalog.DataTypeFactory)1 FunctionCatalog (org.apache.flink.table.catalog.FunctionCatalog)1 UnresolvedIdentifier (org.apache.flink.table.catalog.UnresolvedIdentifier)1