为什么在 presto 中被 st_distance 过滤时请求失败?

Why does request fail when filtered by st_distance in presto?

我尝试在我的请求中按 st_distance 进行过滤,但很快就失败了,说我的纬度不在范围 (-90,90) 内,没有过滤请求它正在工作:

presto> SELECT id, id_type, lat, lon, ST_Distance(to_spherical_geography(ST_Point(lat, lon)), to_spherical_geography(ST_Point(59.988658, 30.200408))) 
       FROM geo.geo_data 
       WHERE ST_Distance(to_spherical_geography(ST_Point(lat, lon)), to_spherical_geography(ST_Point(59.988658, 30.200408))) < 500.0;

Query failed: Latitude must be between -90 and 90

您的 table 中有一些不正确的数据。您可以使用 try().

方便地找到它
SELECT * 
FROM geo.geo_data
WHERE try(ST_Point(lat, lon)) IS NULL