Share via


h3_try_validate

Returns the input value if it is a valid H3 cell or None otherwise. Supports Spark Connect.

For the corresponding Databricks SQL function, see h3_try_validate function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.h3_try_validate(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str An integer or string.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686042433355775,),(599686042433355776,),], ['h3l'])
df.select(dbf.h3_try_validate('h3l').alias('result')).collect()
[Row(result=599686042433355775), Row(result=None)]