Fixes #21825

Makes the GIS compiler adhere to the new query expression API.