Clone the query, move the memory kept in the AST over to the query so all memory is kept in one location.