public static <InputT> GloballyDistinct<InputT> globally() {
    return GloballyDistinct.<InputT>builder().build();
  }
@Test
  public void customObject() {
    final int cardinality = 500;
    final int p = 15;
    final double expectedErr = 1.04 / Math.sqrt(p);

    Schema schema =
        SchemaBuilder.record("User")
            .fields()
            .requiredString("Pseudo")
            .requiredInt("Age")
            .endRecord();
    List<GenericRecord> users = new ArrayList<>();
    for (int i = 1; i <= cardinality; i++) {
      GenericData.Record newRecord = new GenericData.Record(schema);
      newRecord.put("Pseudo", "User" + i);
      newRecord.put("Age", i);
      users.add(newRecord);
    }
    PCollection<Long> results =
        tp.apply("Create stream", Create.of(users).withCoder(AvroCoder.of(schema)))
            .apply(
                "Test custom object",
                ApproximateDistinct.<GenericRecord>globally().withPrecision(p));

    PAssert.that("Verify Accuracy for custom object", results)
        .satisfies(new VerifyAccuracy(cardinality, expectedErr));

    tp.run();
  }