private static void sizeIncrementOfKey(int[] size, String key, Map<String, Integer> keyTable) {
    int keyLength = key.getBytes(UTF_8).length;
    Integer idx = keyTable.get(key);
    if (idx == null) {
      size[0] += 1 + VarInt.getLength(keyLength) + keyLength; // encoding of key in key table
    }
    size[1] += 1 + VarInt.getLength(idx != null ? idx : keyTable.size()); // key reference in record
  }
@Test
  public void testSizeIncrementOfKey() {
    int increment = aggregator.sizeIncrement(PARTITION_KEY, null, null);
    System.out.println(increment);
    aggregator.addRecord(PARTITION_KEY, null, null);

    // same partition key is added only once
    System.out.println(aggregator.sizeIncrement(PARTITION_KEY, null, null));
    assertThat(increment - aggregator.sizeIncrement(PARTITION_KEY, null, null))
        .isEqualTo(PARTITION_KEY_OVERHEAD);

    increment = aggregator.sizeIncrement(PARTITION_KEY, HASH_KEY, null);
    aggregator.addRecord(PARTITION_KEY, HASH_KEY, null);

    // same hash key is added only once
    assertThat(increment - aggregator.sizeIncrement(PARTITION_KEY, HASH_KEY, null))
        .isEqualTo(HASH_KEY_OVERHEAD);
  }