---
title: h3_tochildren function
description: Learn the syntax of the h3\_tochildren function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_tochildren
---

# `h3_tochildren` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 11.3 LTS and above ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Lakehouse//RT

Returns an array of the children H3 cells of the input H3 cell at the specified resolution.

## Syntax

```
h3_tochildren ( h3cellIdExpr, resolutionExpr )
```

## Arguments

* `h3CellIdExpr`: A BIGINT expression, or a hexadecimal STRING expression representing an H3 cell ID.
* `resolutionExpr`: An INT expression, whose value is expected to be between `h3_resolution(h3CellIdExpr)` and `15` inclusive, specifying the resolution of the children H3 cell IDs.

## Returns

An ARRAY of values of the same type as the type of the `h3CellIdExpr` expression, corresponding to the children H3 cell IDs of the input H3 cell at the specified resolution.

The function returns NULL if any of the two input expressions is NULL.
The function does partial validation regarding whether the input argument is a valid H3 cell ID. A necessary, but not sufficient condition for a valid H3 ID is that its value is between `0x08001fffffffffff` and `0x08ff3b6db6db6db6`.
The behavior of the function is undefined if the input cell ID is not a valid cell ID.
If the value of the `resolutionExpr` is equal to the resolution of the input H3 cell ID, the returned array contains a single value equal to the input H3 cell ID.

## Error conditions

* If `h3CellIdExpr` is a STRING that cannot be converted to a BIGINT or corresponds to a BIGINT value that is smaller than `0x08001fffffffffff` or larger than `0x08ff3b6db6db6db6`, the function returns [H3\_INVALID\_CELL\_ID](https://docs.databricks.com/aws/en/error-messages/h3-invalid-cell-id-error-class.md).
* If `resolutionExpr` is smaller than `h3_resolution(h3CellIdExpr)` or larger than `15`, the function returns [H3\_INVALID\_RESOLUTION\_VALUE](https://docs.databricks.com/aws/en/error-messages/h3-invalid-resolution-value-error-class.md).

## Examples

```sql
-- Simple example taking a long as input.
> SELECT h3_tochildren(599686042433355775, 6);
  [604189641121202175,604189641255419903,604189641389637631,604189641523855359,604189641658073087,604189641792290815,604189641926508543]

-- Simple example taking a hexadecimal string as input.
> SELECT h3_tochildren('85283473fffffff', 6);
  [862834707ffffff,86283470fffffff,862834717ffffff,86283471fffffff,862834727ffffff,86283472fffffff,862834737ffffff]

-- First input is an invalid H3 cell ID.
> SELECT h3_tochildren(0, 15);
  [H3_INVALID_CELL_ID] 0 is not a valid H3 cell ID

-- Second input is an invalid resolution value.
> SELECT h3_tochildren('85283473fffffff', 0);
  [H3_INVALID_RESOLUTION_VALUE] H3 resolution 0 must be between 5 and 15, inclusive
```

## Related functions

* [`h3_ischildof` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_ischildof.md)
* [`h3_maxchild` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_maxchild.md)
* [`h3_minchild` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_minchild.md)
* [`h3_resolution` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_resolution.md)
* [`h3_toparent` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/h3_toparent.md)
