CountNulls implements AggregateFunction<Long, CountNulls> { public CountNulls(String fieldName) { this.fieldName = fieldName; } CountNulls(String fieldName); @Override void initialize(); @Override void mergeValue(StructuredRecord record); @Override void mergeAggregates(CountNulls otherAgg); @Override Long getAggregate(); @Override Schema getOutputSchema();  }
@Test public void testCountNulls() { Schema schema = Schema.recordOf( "test", Schema.Field.of("x", Schema.nullableOf(Schema.of(Schema.Type.INT)))); test(new CountNulls("x"), schema, "x", 2L, Arrays.asList(1, 2, null, null, 3), new CountNulls("x")); test(new CountNulls("x"), schema, "x", 0L, Arrays.asList(1, 2, 3, 4, 5), new CountNulls("x")); }