蜂巢中的文森蒂距离



我能够在presto中计算文森特距离,但对于我的一个案例,我想计算蜂巢中的文森特距离。我搜索了,但我找不到任何东西。有没有办法计算蜂巢中的文森特距离。

似乎您也可以将下一个代码与 Impala 一起使用,也可以与 HIVE 一起使用。因此,在HIVE中会更慢。

select
2 * asin(
sqrt(
cos(radians(lat1)) *
cos(radians(lat2)) *
pow(sin(radians((lon1 - lon2)/2)), 2)
+
pow(sin(radians((lat1 - lat2)/2)), 2)
)
) * 6371 distance_km
from my_table;

学分:https://godatadriven.com/blog/distance-calculation-with-impala-or-hive/

最新更新