convert TEZ queries to count