(PDB-658) Moving events querying to the new query engine

This commit moves over the existing event querying features into the
query engine. This required extending the query engine to support
>,>=,<,<= on dates and some additional validation on subqueries.

This does NOT include moving over distinct-resources? to the new query
engine.