use of org.apache.asterix.om.base.AGeneratedUUID in project asterixdb by apache.
the class CreateUUIDDescriptor method createEvaluatorFactory.
@Override
public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
return new IScalarEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
private final ISerializerDeserializer<AUUID> uuidSerDe = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
@Override
public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
private final DataOutput output = resultStorage.getDataOutput();
private final AGeneratedUUID uuid = new AGeneratedUUID();
@Override
public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
uuid.nextUUID();
resultStorage.reset();
uuidSerDe.serialize(uuid, output);
result.set(resultStorage);
}
};
}
};
}
use of org.apache.asterix.om.base.AGeneratedUUID in project asterixdb by apache.
the class UUIDDescriptor method createEvaluatorFactory.
@Override
public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
return new IScalarEvaluatorFactory() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
private final ISerializerDeserializer<AUUID> uuidSerDe = SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
@Override
public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
return new IScalarEvaluator() {
private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
private final DataOutput output = resultStorage.getDataOutput();
private final AGeneratedUUID uuid = new AGeneratedUUID();
@Override
public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
uuid.nextUUID();
resultStorage.reset();
uuidSerDe.serialize(uuid, output);
result.set(resultStorage);
}
};
}
};
}
Aggregations