use of org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory in project asterixdb by apache.
the class EmptyStreamAggregateDescriptor method createAggregateEvaluatorFactory.
@Override
public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args) {
return new IAggregateEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@Override
public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws HyracksDataException {
return new IAggregateEvaluator() {
private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
@SuppressWarnings("rawtypes")
private ISerializerDeserializer serde = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ABOOLEAN);
boolean res = true;
@Override
public void init() throws HyracksDataException {
res = true;
}
@Override
public void step(IFrameTupleReference tuple) throws HyracksDataException {
res = false;
}
@SuppressWarnings("unchecked")
@Override
public void finish(IPointable result) throws HyracksDataException {
resultStorage.reset();
ABoolean b = res ? ABoolean.TRUE : ABoolean.FALSE;
serde.serialize(b, resultStorage.getDataOutput());
result.set(resultStorage);
}
@Override
public void finishPartial(IPointable result) throws HyracksDataException {
finish(result);
}
};
}
};
}
Aggregations