Skip to main content

h3_tochildren

Returns the children H3 cell IDs of the input H3 cell ID at the specified resolution. Supports Spark Connect.

For the corresponding Databricks SQL function, see h3_tochildren function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

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

Parameters

Parameter

Type

Description

col1

pyspark.sql.Column or str

An H3 cell ID (represented as a BIGINT or a string).

col2

pyspark.sql.Column, str, or int

The resolution of the child H3 cell IDs to return. Must greater or equal to the resolution of the first argument, and smaller than 16.

Examples

Python
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()
Output
[Row(result=[604189641121202175, 604189641255419903, 604189641389637631, 604189641523855359,     604189641658073087, 604189641792290815, 604189641926508543])]
Python
df.select(dbf.h3_tochildren('h3l', 6).alias('result')).collect()
Output
[Row(result=[604189641121202175, 604189641255419903, 604189641389637631, 604189641523855359,     604189641658073087, 604189641792290815, 604189641926508543])]