Move to macro query impls to remove .upcast() in client code