DISTANCE

This page describes the DISTANCE function in Lenses SQL.

DISTANCE(x1,y1,x2,y2)

Calculates the distance between two points using the haversine method.

Available in:

Processors
SQL Studio

Sample code:

USE `kafka`;
SELECT 
    DISTANCE(pickup_latitude, pickup_longitude, dropoff_latitude, dropoff_longitude) 
    FROM nyc-yellow-taxi-trip
LIMIT 1;

Output:

{
  "value": {
    "DISTANCE": "8579.658400770431"
  }
}

Last updated

Logo

2024 © Lenses.io Ltd. Apache, Apache Kafka, Kafka and associated open source project names are trademarks of the Apache Software Foundation.