snowflake.snowpark.functions.h3_compact_cells

snowflake.snowpark.functions.h3_compact_cells(array_of_cell_ids: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns a compacted array of H3 cell IDs by merging cells at the same resolution into their parent cells when possible.

Parameters:

array_of_cell_ids (ColumnOrName) – An array of H3 cell IDs to be compacted.

Returns:

An array of compacted H3 cell IDs.

Return type:

Column

Example::
>>> df = session.create_dataframe([
...     [[622236750562230271, 622236750562263039, 622236750562295807, 622236750562328575, 622236750562361343, 622236750562394111, 622236750562426879, 622236750558396415]]
... ], schema=["cell_ids"])
>>> df.select(h3_compact_cells(df["cell_ids"]).alias("compacted")).collect()
[Row(COMPACTED='[\n  622236750558396415,\n  617733150935089151\n]')]
Copy