AvroUtils { public static Row toBeamRowStrict(GenericRecord record, @Nullable Schema schema) { if (schema == null) { schema = toBeamSchema(record.getSchema()); } Row.Builder builder = Row.withSchema(schema); org.apache.avro.Schema avroSchema = record.getSchema(); for (Schema.Field field : schema.getFields()) { Object value = record.get(field.getName()); org.apache.avro.Schema fieldAvroSchema = avroSchema.getField(field.getName()).schema(); builder.addValue(convertAvroFieldStrict(value, fieldAvroSchema, field.getType())); } return builder.build(); } private  AvroUtils(); static Schema.Field toBeamField(org.apache.avro.Schema.Field field); static org.apache.avro.Schema.Field toAvroField(Schema.Field field, String namespace); static Schema toBeamSchema(org.apache.avro.Schema schema); static org.apache.avro.Schema toAvroSchema(
      Schema beamSchema, @Nullable String name, @Nullable String namespace); static org.apache.avro.Schema toAvroSchema(Schema beamSchema); static Row toBeamRowStrict(GenericRecord record, @Nullable Schema schema); static GenericRecord toGenericRecord(
      Row row, org.apache.avro.@Nullable Schema avroSchema); @SuppressWarnings("unchecked") static SerializableFunction<T, Row> getToRowFunction(
      Class<T> clazz, org.apache.avro.@Nullable Schema schema); @SuppressWarnings("unchecked") static SerializableFunction<Row, T> getFromRowFunction(Class<T> clazz); static @Nullable Schema getSchema(
      Class<T> clazz, org.apache.avro.@Nullable Schema schema); static SerializableFunction<GenericRecord, Row> getGenericRecordToRowFunction(
      @Nullable Schema schema); static SerializableFunction<Row, GenericRecord> getRowToGenericRecordFunction(
      org.apache.avro.@Nullable Schema avroSchema); static SchemaCoder<T> schemaCoder(TypeDescriptor<T> type); static SchemaCoder<T> schemaCoder(Class<T> clazz); static SchemaCoder<GenericRecord> schemaCoder(org.apache.avro.Schema schema); static SchemaCoder<T> schemaCoder(Class<T> clazz, org.apache.avro.Schema schema); static SchemaCoder<T> schemaCoder(AvroCoder<T> avroCoder); static List<FieldValueTypeInformation> getFieldTypes(Class<T> clazz, Schema schema); static List<FieldValueGetter> getGetters(Class<T> clazz, Schema schema); static SchemaUserTypeCreator getCreator(Class<T> clazz, Schema schema); @SuppressWarnings("unchecked") static @Nullable Object convertAvroFieldStrict(
      @Nullable Object value,
      @Nonnull org.apache.avro.Schema avroSchema,
      @Nonnull Schema.FieldType fieldType);  }
@Test public void testGenericRecordToBeamRow() { GenericRecord genericRecord = getGenericRecord(); Row row = AvroUtils.toBeamRowStrict(getGenericRecord(), null); assertEquals(getBeamRow(), row); genericRecord.put("timestampMillis", new DateTime(genericRecord.get("timestampMillis"))); row = AvroUtils.toBeamRowStrict(getGenericRecord(), null); assertEquals(getBeamRow(), row); }