@Test public void testGetNumberOfFilledFields() { assertEquals(8, CollapserUtils.getNumberOfFilledFields(SampleData.metadataRecord11, null)); assertEquals(2, CollapserUtils.getNumberOfFilledFields(SampleData.metadataRecord11, SampleData.significantFields)); }
public static int getNumberOfFilledFields(IndexedRecord record, List<String> fields) { int number = 0; for (Field field: record.getSchema().getFields()) { if ((fields == null || fields.contains(field.name())) && record.get(field.pos()) != null) { number++; } } return number; }
CollapserUtils { public static int getNumberOfFilledFields(IndexedRecord record, List<String> fields) { int number = 0; for (Field field: record.getSchema().getFields()) { if ((fields == null || fields.contains(field.name())) && record.get(field.pos()) != null) { number++; } } return number; } }
CollapserUtils { public static int getNumberOfFilledFields(IndexedRecord record, List<String> fields) { int number = 0; for (Field field: record.getSchema().getFields()) { if ((fields == null || fields.contains(field.name())) && record.get(field.pos()) != null) { number++; } } return number; } private  CollapserUtils(); }
CollapserUtils { public static int getNumberOfFilledFields(IndexedRecord record, List<String> fields) { int number = 0; for (Field field: record.getSchema().getFields()) { if ((fields == null || fields.contains(field.name())) && record.get(field.pos()) != null) { number++; } } return number; } private  CollapserUtils(); static boolean haveEqualSchema(Collection<IndexedRecord> records); static boolean isEnvelopeSchema(Schema schema); static String getOriginValue(IndexedRecord record); static IndexedRecord getDataRecord(IndexedRecord record); @SuppressWarnings("unchecked") static T getNestedFieldValue(IndexedRecord record, String fieldName); static int getNumberOfFilledFields(IndexedRecord record, List<String> fields); static void sortByFilledDataFields(List<T> records, final List<String> fields); static T merge(T base, T update); }
CollapserUtils { public static int getNumberOfFilledFields(IndexedRecord record, List<String> fields) { int number = 0; for (Field field: record.getSchema().getFields()) { if ((fields == null || fields.contains(field.name())) && record.get(field.pos()) != null) { number++; } } return number; } private  CollapserUtils(); static boolean haveEqualSchema(Collection<IndexedRecord> records); static boolean isEnvelopeSchema(Schema schema); static String getOriginValue(IndexedRecord record); static IndexedRecord getDataRecord(IndexedRecord record); @SuppressWarnings("unchecked") static T getNestedFieldValue(IndexedRecord record, String fieldName); static int getNumberOfFilledFields(IndexedRecord record, List<String> fields); static void sortByFilledDataFields(List<T> records, final List<String> fields); static T merge(T base, T update);  }