```
create table default.test_parent
(
    id        UInt64,
    parent_id Nullable(UInt64)
) engine = MergeTree

create dictionary default.d4test_parent
    ( id UInt64,
    parent_id  Nullable(UInt64) HIERARCHICAL
    )
    PRIMARY KEY id
    SOURCE (CLICKHOUSE(DB 'default' TABLE 'test_parent'))
    LIFETIME (MIN 0 MAX 0)
    LAYOUT (HASHED)
;
insert into default.test_parent
values (1, null),
       (2, 3),
       (3, 1),
       (4, 2)
;
system reload dictionary default.d4test_parent
;
select dictGetDescendants('default.d4test_parent', toUInt64(2))
;
```

Code: 53. DB::Exception: default.d4test_parent (443f6664-e217-44ec-80e2-bbec982b4963): type mismatch: column has wrong type expected UInt64: While processing dictGetDescendants('default.d4test_parent', 2). (TYPE_MISMATCH) (version 22.3.2.1)


On old versions no errors
```
select version()
-- 21.11.6.7
;
select dictGetDescendants('default.d4test_parent', toUInt64(2))
-- [4]
```
};
    /** Calculate hierarchy for keys iterating the hierarchy from child to parent using get_parent_key_func provided by client.
      * Hierarchy iteration is stopped if key equals null value, get_parent_key_func returns null optional, or hierarchy depth
      * greater or equal than DBMS_HIERARCHICAL_DICTIONARY_MAX_DEPTH.
      * IsKeyValidFunc used for each input hierarchy key, if it returns false result hierarchy for that key will have size 0.
      * Hierarchy result is ElementsAndOffsets structure, for each element there is hierarchy array,
      * with size offset[element_index] - (element_index > 0 ? offset[element_index - 1] : 0).
      *
      * Example:
      * id  parent_id
      * 1   0
      * 2   1
      * 3   1
      * 4   2
      *
      * If hierarchy_null_value will be 0. Requested keys [1, 2, 3, 4, 5].
      * Result: [1], [2, 1], [3, 1], [4, 2, 1], []
      * Elements: [1, 2, 1, 3, 1, 4, 2, 1]
      * Offsets: [1, 3, 5, 8, 8]
      */
    template <typename IsKeyValidFunc, typename GetParentKeyFunc>
    ElementsAndOffsets getHierarchy(
        const PaddedPODArray<UInt64> & keys,
        const UInt64 & hierarchy_null_value,
        IsKeyValidFunc && is_key_valid_func,
        GetParentKeyFunc && get_parent_key_func)
    {
        size_t hierarchy_keys_size = keys.size();
        PaddedPODArray<UInt64> elements;
        elements.reserve(hierarchy_keys_size);