Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025.
If you would like to use Python UDFs, create the UDFs prior to that date.
Existing Python UDFs will continue to function as normal. For more information, see the
blog post
H3_ToParent
H3_ToParent returns the parent H3 cell ID at a specified parent resolution for a given H3 index. For information about H3 indexing, see H3.
Syntax
H3_ToParent(index, resolution)
Arguments
- index
-
A value of data type
BIGINTorVARCHARthat represents the index of an H3 cell, or an expression that evaluates to one of these data types. - resolution
-
A value of data type
INTEGERor an expression that evaluates to anINTEGERtype. The value represents the resolution of the parent cell ID. The value must be between 0 and the resolution of index, inclusive.
Return type
BIGINT – represents the parent's H3 cell ID.
If either index or resolution is NULL, then NULL is returned.
If index is not valid, then an error is returned.
If resolution is less than 0 or greater than the resolution of index, then an error is returned.
Examples
The following SQL inputs a VARCHAR that represents the index of an H3 cell, and an INTEGER that represents the desired resolution of the desired parent, and returns a BIGINT that represents the parent at resolution 0 of the input H3 cell.
SELECT H3_ToParent('85283473fffffff', 0);
h3_toparent
--------------------
577199624117288959
The following SQL inputs a BIGINT that represents the index of an H3 cell, and an INTEGER that represents the desired resolution of the desired parent, and returns a BIGINT that represents the parent at resolution 0 of the input H3 cell.
SELECT H3_ToParent(646078419604526808, 8);
h3_toparent
--------------------
614553222213795839