dup the query so the existing query is not modified
Adding specs for #2979