@Override
    public void collectSizeStats(StateObjectSizeStatsCollector collector) {
        // TODO: for now this ignores that only some key groups might be accessed when reading the
        //  state, so this only reports the upper bound. We could introduce
        //  #collectSizeStats(StateObjectSizeStatsCollector, KeyGroupRange) in KeyedStateHandle
        //  that computes which groups where actually touched and computes the size, depending on
        //  the exact state handle type, from either the offsets (e.g. here) or for the full size
        //  (e.g. remote incremental) when we restore from managed/raw keyed state.
        stateHandle.collectSizeStats(collector);
    }
@Test
    void testCollectSizeStats() {
        final KeyGroupRangeOffsets offsets = new KeyGroupRangeOffsets(0, 7);
        final byte[] data = new byte[5];
        final ByteStreamStateHandle innerHandle = new ByteStreamStateHandle("name", data);
        KeyGroupsStateHandle handle = new KeyGroupsStateHandle(offsets, innerHandle);
        StateObject.StateObjectSizeStatsCollector statsCollector =
                StateObject.StateObjectSizeStatsCollector.create();
        handle.collectSizeStats(statsCollector);
        Assertions.assertEquals(
                new HashMap<StateObject.StateObjectLocation, Long>() {
                    {
                        put(StateObject.StateObjectLocation.LOCAL_MEMORY, (long) data.length);
                    }
                },
                statsCollector.getStats());
    }