fix classcastexception happens on while serializing query results
Merge pull request #3074 from eminn/fix/query-classcastexception

fix classcastexception happens on while serializing query results