共用方式為


h3_tochildren

根據指定解析度,回傳輸入的 H3 cell ID 所對應的子 H3 cell ID。 支援 Spark Connect。

關於對應的 Databricks SQL 函式,請參見 h3_tochildren 函數

語法

from pyspark.databricks.sql import functions as dbf

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

參數

參數 類型 Description
col1 pyspark.sql.Columnstr H3 cell ID(以 BIGINT 或字串表示)。
col2 pyspark.sql.Columnstrint 子層級 H3 cell ID 的解析結果將被回傳。 必須大於或等於第一個論點的解決值,且小於16。

範例

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686042433355775, 6,)], ['h3l', 'res'])
df.select(dbf.h3_tochildren('h3l', 'res').alias('result')).collect()
[Row(result=[604189641121202175, 604189641255419903, 604189641389637631, 604189641523855359,     604189641658073087, 604189641792290815, 604189641926508543])]
df.select(dbf.h3_tochildren('h3l', 6).alias('result')).collect()
[Row(result=[604189641121202175, 604189641255419903, 604189641389637631, 604189641523855359,     604189641658073087, 604189641792290815, 604189641926508543])]