TEIID-3065, TEIID-3066: Fixed NPE, and implemented count(*) capability