Search in sources :

Example 1 with FirstLastValueServerAggregator

use of org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator in project phoenix by apache.

the class NthValueFunction method newServerAggregator.

@Override
public Aggregator newServerAggregator(Configuration conf) {
    FirstLastValueServerAggregator aggregator = new FirstLastValueServerAggregator();
    offset = ((Number) ((LiteralExpression) children.get(3)).getValue()).intValue();
    boolean order = (Boolean) ((LiteralExpression) children.get(1)).getValue();
    aggregator.init(children, order, offset);
    return aggregator;
}
Also used : LiteralExpression(org.apache.phoenix.expression.LiteralExpression) FirstLastValueServerAggregator(org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator) PBoolean(org.apache.phoenix.schema.types.PBoolean)

Example 2 with FirstLastValueServerAggregator

use of org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator in project phoenix by apache.

the class FirstValueFunction method newServerAggregator.

@Override
public Aggregator newServerAggregator(Configuration conf) {
    FirstLastValueServerAggregator aggregator = new FirstLastValueServerAggregator();
    boolean order = (Boolean) ((LiteralExpression) children.get(1)).getValue();
    aggregator.init(children, order, 0);
    return aggregator;
}
Also used : FirstLastValueServerAggregator(org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator) PBoolean(org.apache.phoenix.schema.types.PBoolean)

Example 3 with FirstLastValueServerAggregator

use of org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator in project phoenix by apache.

the class LastValueFunction method newServerAggregator.

@Override
public Aggregator newServerAggregator(Configuration conf) {
    FirstLastValueServerAggregator aggregator = new FirstLastValueServerAggregator();
    //invert order for LAST_BY function cause it is inverted version of FIRST_BY
    boolean order = !(Boolean) ((LiteralExpression) children.get(1)).getValue();
    aggregator.init(children, order, 0);
    return aggregator;
}
Also used : LiteralExpression(org.apache.phoenix.expression.LiteralExpression) FirstLastValueServerAggregator(org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator)

Aggregations

FirstLastValueServerAggregator (org.apache.phoenix.expression.aggregator.FirstLastValueServerAggregator)3 LiteralExpression (org.apache.phoenix.expression.LiteralExpression)2 PBoolean (org.apache.phoenix.schema.types.PBoolean)2