fix bugx in rewriting count-distinct query when it contains limit token, move it out to subtree of outer TOK_INSERT