h3_distance

Returnerar rutnätsavståndet mellan två H3-cell-ID:t. Stöder Spark Connect.

För motsvarande Databricks SQL-funktion, se h3_distance funktion.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.h3_distance(col1=<col1>, col2=<col2>)

Parameterar

Parameter Typ Description
col1 pyspark.sql.Column eller str Ett H3-cell-ID, representerat som en kolumn eller sträng.
col2 pyspark.sql.Column eller str Ett H3-cell-ID, representerat som en kolumn eller sträng.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686030622195711, 599686015589810175,)], ['h3l1', 'h3l2'])
df.select(dbf.h3_distance('h3l1', 'h3l2').alias('result')).collect()
[Row(result=2)]