finisced implementation of QueryEngine with relative tests