Search in sources :

Example 1 with FloorOperatorConversion

use of org.apache.calcite.adapter.druid.FloorOperatorConversion in project hive by apache.

the class DruidSqlOperatorConverter method getDefaultMap.

public static final Map<SqlOperator, org.apache.calcite.adapter.druid.DruidSqlOperatorConverter> getDefaultMap() {
    if (druidOperatorMap == null) {
        druidOperatorMap = new HashMap<SqlOperator, org.apache.calcite.adapter.druid.DruidSqlOperatorConverter>();
        DruidQuery.DEFAULT_OPERATORS_LIST.stream().forEach(op -> druidOperatorMap.put(op.calciteOperator(), op));
        // Override Hive specific operators
        druidOperatorMap.putAll(Maps.asMap(HiveFloorDate.ALL_FUNCTIONS, (Function<SqlFunction, org.apache.calcite.adapter.druid.DruidSqlOperatorConverter>) input -> new FloorOperatorConversion()));
        druidOperatorMap.putAll(Maps.asMap(HiveExtractDate.ALL_FUNCTIONS, (Function<SqlFunction, org.apache.calcite.adapter.druid.DruidSqlOperatorConverter>) input -> new ExtractOperatorConversion()));
        druidOperatorMap.put(HiveConcat.INSTANCE, new DirectOperatorConversion(HiveConcat.INSTANCE, "concat"));
        druidOperatorMap.put(SqlStdOperatorTable.SUBSTRING, new DruidSqlOperatorConverter.DruidSubstringOperatorConversion());
    }
    return druidOperatorMap;
}
Also used : ExtractOperatorConversion(org.apache.calcite.adapter.druid.ExtractOperatorConversion) SqlOperator(org.apache.calcite.sql.SqlOperator) DirectOperatorConversion(org.apache.calcite.adapter.druid.DirectOperatorConversion) Function(com.google.common.base.Function) SqlFunction(org.apache.calcite.sql.SqlFunction) FloorOperatorConversion(org.apache.calcite.adapter.druid.FloorOperatorConversion)

Aggregations

Function (com.google.common.base.Function)1 DirectOperatorConversion (org.apache.calcite.adapter.druid.DirectOperatorConversion)1 ExtractOperatorConversion (org.apache.calcite.adapter.druid.ExtractOperatorConversion)1 FloorOperatorConversion (org.apache.calcite.adapter.druid.FloorOperatorConversion)1 SqlFunction (org.apache.calcite.sql.SqlFunction)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1