หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Returns the grid distance between two H3 cell IDs of the same resolution, or None if the distance if undefined.
For the corresponding Databricks SQL function, see h3_try_distance function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.h3_try_distance(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
An H3 cell ID, represented as a Column or string. |
col2 |
pyspark.sql.Column or str |
An H3 cell ID, represented as a Column or string. |
Examples
from pyspark.databricks.sql import functions as dbf
df1 = spark.createDataFrame([(599686030622195711, 599686015589810175,)], ['h3l1', 'h3l2'])
df1.select(dbf.h3_try_distance('h3l1', 'h3l2').alias('result')).collect()
[Row(result=2)]
df2 = spark.createDataFrame([(644730217149254377, 644877068142171537,)], ['h3l1', 'h3l2'])
df2.select(dbf.h3_try_distance('h3l1', 'h3l2').alias('result')).collect()
[Row(result=None)]