public static <K, V> PerKey<K, V> perKey() {
    return new AutoValue_ApproximateCountDistinct_PerKey.Builder<K, V>()
        .setPrecision(HllCount.DEFAULT_PRECISION)
        .build();
  }
@Test
  @Category(NeedsRunner.class)
  public void testObjectTypesPerKey() {

    List<KV<Integer, KV<Integer, Integer>>> ints = new ArrayList<>();

    for (int i = 0; i < 3; i++) {
      for (int k : INTS1) {
        ints.add(KV.of(i, KV.of(i, k)));
      }
    }

    PCollection<KV<Integer, Long>> approxResultInteger =
        p.apply("Int", Create.of(ints))
            .apply(
                "IntHLL",
                ApproximateCountDistinct.<Integer, KV<Integer, Integer>>perKey()
                    .via(x -> KV.of(x.getKey(), (long) x.hashCode()))
                    .withPercision(TEST_PRECISION));

    PAssert.that(approxResultInteger)
        .containsInAnyOrder(
            ImmutableList.of(
                KV.of(0, INTS1_ESTIMATE), KV.of(1, INTS1_ESTIMATE), KV.of(2, INTS1_ESTIMATE)));

    p.run();
  }