Search in sources :

Example 1 with SqlOperatorConversion

use of org.apache.druid.sql.calcite.expression.SqlOperatorConversion in project druid by druid-io.

the class DruidOperatorTable method lookupOperatorOverloads.

@Override
public void lookupOperatorOverloads(final SqlIdentifier opName, final SqlFunctionCategory category, final SqlSyntax syntax, final List<SqlOperator> operatorList, final SqlNameMatcher nameMatcher) {
    if (opName == null) {
        return;
    }
    if (opName.names.size() != 1) {
        return;
    }
    final OperatorKey operatorKey = OperatorKey.of(opName.getSimple(), syntax);
    final SqlAggregator aggregator = aggregators.get(operatorKey);
    if (aggregator != null) {
        operatorList.add(aggregator.calciteFunction());
    }
    final SqlOperatorConversion operatorConversion = operatorConversions.get(operatorKey);
    if (operatorConversion != null) {
        operatorList.add(operatorConversion.calciteOperator());
    }
    final SqlOperator convertletOperator = CONVERTLET_OPERATORS.get(operatorKey);
    if (convertletOperator != null) {
        operatorList.add(convertletOperator);
    }
}
Also used : EarliestLatestBySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestBySqlAggregator) ArrayConcatSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.ArrayConcatSqlAggregator) MaxSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.MaxSqlAggregator) MinSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.MinSqlAggregator) BuiltinApproxCountDistinctSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.BuiltinApproxCountDistinctSqlAggregator) SqlAggregator(org.apache.druid.sql.calcite.aggregation.SqlAggregator) StringSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.StringSqlAggregator) BitwiseSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.BitwiseSqlAggregator) ArraySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.ArraySqlAggregator) SumZeroSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.SumZeroSqlAggregator) AvgSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.AvgSqlAggregator) GroupingSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.GroupingSqlAggregator) EarliestLatestAnySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestAnySqlAggregator) SumSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.SumSqlAggregator) SqlOperator(org.apache.calcite.sql.SqlOperator) SqlOperatorConversion(org.apache.druid.sql.calcite.expression.SqlOperatorConversion)

Example 2 with SqlOperatorConversion

use of org.apache.druid.sql.calcite.expression.SqlOperatorConversion in project druid by druid-io.

the class DruidOperatorTable method getOperatorList.

@Override
public List<SqlOperator> getOperatorList() {
    final List<SqlOperator> retVal = new ArrayList<>();
    for (SqlAggregator aggregator : aggregators.values()) {
        retVal.add(aggregator.calciteFunction());
    }
    for (SqlOperatorConversion operatorConversion : operatorConversions.values()) {
        retVal.add(operatorConversion.calciteOperator());
    }
    retVal.addAll(DruidConvertletTable.knownOperators());
    return retVal;
}
Also used : SqlOperator(org.apache.calcite.sql.SqlOperator) EarliestLatestBySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestBySqlAggregator) ArrayConcatSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.ArrayConcatSqlAggregator) MaxSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.MaxSqlAggregator) MinSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.MinSqlAggregator) BuiltinApproxCountDistinctSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.BuiltinApproxCountDistinctSqlAggregator) SqlAggregator(org.apache.druid.sql.calcite.aggregation.SqlAggregator) StringSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.StringSqlAggregator) BitwiseSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.BitwiseSqlAggregator) ArraySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.ArraySqlAggregator) SumZeroSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.SumZeroSqlAggregator) AvgSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.AvgSqlAggregator) GroupingSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.GroupingSqlAggregator) EarliestLatestAnySqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestAnySqlAggregator) SumSqlAggregator(org.apache.druid.sql.calcite.aggregation.builtin.SumSqlAggregator) ArrayList(java.util.ArrayList) SqlOperatorConversion(org.apache.druid.sql.calcite.expression.SqlOperatorConversion)

Aggregations

SqlOperator (org.apache.calcite.sql.SqlOperator)2 SqlAggregator (org.apache.druid.sql.calcite.aggregation.SqlAggregator)2 ArrayConcatSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.ArrayConcatSqlAggregator)2 ArraySqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.ArraySqlAggregator)2 AvgSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.AvgSqlAggregator)2 BitwiseSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.BitwiseSqlAggregator)2 BuiltinApproxCountDistinctSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.BuiltinApproxCountDistinctSqlAggregator)2 EarliestLatestAnySqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestAnySqlAggregator)2 EarliestLatestBySqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.EarliestLatestBySqlAggregator)2 GroupingSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.GroupingSqlAggregator)2 MaxSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.MaxSqlAggregator)2 MinSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.MinSqlAggregator)2 StringSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.StringSqlAggregator)2 SumSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.SumSqlAggregator)2 SumZeroSqlAggregator (org.apache.druid.sql.calcite.aggregation.builtin.SumZeroSqlAggregator)2 SqlOperatorConversion (org.apache.druid.sql.calcite.expression.SqlOperatorConversion)2 ArrayList (java.util.ArrayList)1