Skip to content

Commit

Permalink
make implementation with pow() default
Browse files Browse the repository at this point in the history
  • Loading branch information
bastienboutonnet committed Mar 14, 2021
1 parent a292695 commit a4db0f3
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions macros/geo/haversine_distance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ The arguments should be float type.
{# vanilla macro is in miles #}
{% set conversion_rate = '' %}
{% if unit == 'km' %}
{# we multiply miles result to get it in kms #}
{% set conversion_rate = '* 1.60934' %}
{% endif %}

2 * 3961 * asin(sqrt((sin(radians(({{lat2}} - {{lat1}}) / 2))) ^ 2 +
cos(radians({{lat1}})) * cos(radians({{lat2}})) *
(sin(radians(({{lon2}} - {{lon1}}) / 2))) ^ 2)) {{conversion_rate}}

{%- endmacro %}

{% macro snowflake__haversine_distance(lat1,lon1,lat2,lon2,unit) -%}
{# vanilla macro is in miles #}
{% set conversion_rate = '' %}
{% if unit == 'km' %}
{# we multiply miles result to get it in kms #}
{% set conversion_rate = '* 1.60934' %}
{% endif %}
Expand Down

0 comments on commit a4db0f3

Please sign in to comment.