Search in sources :

Example 1 with CountDistinctDoubleColumnAggregateFunction

use of io.ordinate.engine.function.aggregate.count.CountDistinctDoubleColumnAggregateFunction in project Mycat2 by MyCATApache.

the class ExecuteCompiler method countDistinct.

public AccumulatorFunction countDistinct(PhysicalPlan input, int index) {
    PhysicalPlan peek = input;
    Field field = peek.schema().getFields().get(index);
    ArrowType outputType = InnerType.castToAggType(field.getType());
    switch(InnerType.from(outputType)) {
        case INT32_TYPE:
        case INT64_TYPE:
            return new CountDistinctLongColumnAggregateFunction(index);
        case DOUBLE_TYPE:
        default:
            return new CountDistinctDoubleColumnAggregateFunction(index);
    }
}
Also used : Field(org.apache.arrow.vector.types.pojo.Field) CountDistinctDoubleColumnAggregateFunction(io.ordinate.engine.function.aggregate.count.CountDistinctDoubleColumnAggregateFunction) CountDistinctLongColumnAggregateFunction(io.ordinate.engine.function.aggregate.count.CountDistinctLongColumnAggregateFunction) ArrowType(org.apache.arrow.vector.types.pojo.ArrowType)

Aggregations

CountDistinctDoubleColumnAggregateFunction (io.ordinate.engine.function.aggregate.count.CountDistinctDoubleColumnAggregateFunction)1 CountDistinctLongColumnAggregateFunction (io.ordinate.engine.function.aggregate.count.CountDistinctLongColumnAggregateFunction)1 ArrowType (org.apache.arrow.vector.types.pojo.ArrowType)1 Field (org.apache.arrow.vector.types.pojo.Field)1