Search in sources :

Example 1 with DrillSqlOperatorWithoutInference

use of org.apache.drill.exec.planner.sql.DrillSqlOperatorWithoutInference in project drill by apache.

the class LocalFunctionRegistry method registerOperatorsWithoutInference.

private void registerOperatorsWithoutInference(DrillOperatorTable operatorTable, Map<String, Collection<DrillFuncHolder>> registeredFunctions) {
    SqlOperator op;
    for (Entry<String, Collection<DrillFuncHolder>> function : registeredFunctions.entrySet()) {
        Set<Integer> argCounts = Sets.newHashSet();
        String name = function.getKey().toUpperCase();
        for (DrillFuncHolder func : function.getValue()) {
            if (argCounts.add(func.getParamCount())) {
                if (func.isAggregating()) {
                    op = new DrillSqlAggOperatorWithoutInference(name, func.getParamCount());
                } else {
                    boolean isDeterministic;
                    // into literals
                    if (DrillConstExecutor.NON_REDUCIBLE_TYPES.contains(func.getReturnType().getMinorType())) {
                        isDeterministic = false;
                    } else {
                        isDeterministic = func.isDeterministic();
                    }
                    op = new DrillSqlOperatorWithoutInference(name, func.getParamCount(), func.getReturnType(), isDeterministic, func.isNiladic());
                }
                operatorTable.addOperatorWithoutInference(function.getKey(), op);
            }
        }
    }
}
Also used : DrillFuncHolder(org.apache.drill.exec.expr.fn.DrillFuncHolder) DrillSqlAggOperatorWithoutInference(org.apache.drill.exec.planner.sql.DrillSqlAggOperatorWithoutInference) DrillSqlOperator(org.apache.drill.exec.planner.sql.DrillSqlOperator) SqlOperator(org.apache.calcite.sql.SqlOperator) DrillSqlOperatorWithoutInference(org.apache.drill.exec.planner.sql.DrillSqlOperatorWithoutInference) Collection(java.util.Collection)

Aggregations

Collection (java.util.Collection)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1 DrillFuncHolder (org.apache.drill.exec.expr.fn.DrillFuncHolder)1 DrillSqlAggOperatorWithoutInference (org.apache.drill.exec.planner.sql.DrillSqlAggOperatorWithoutInference)1 DrillSqlOperator (org.apache.drill.exec.planner.sql.DrillSqlOperator)1 DrillSqlOperatorWithoutInference (org.apache.drill.exec.planner.sql.DrillSqlOperatorWithoutInference)1