Fixed #14334 -- Query comparision now check for object types.

Please see my comment on the PR as to why I made this change.