@Test
  public void canSerializeRecordsWithNullableComplexElements() throws SerDeException, IOException {
    String field = "{ \"name\":\"struct1\", \"type\":{\"type\":\"record\", " +
            "\"name\":\"struct1_name\", \"fields\": [\n" +
                   "{ \"name\":\"sInt\", \"type\":\"int\" }, { \"name\"" +
            ":\"sBoolean\", \"type\":\"boolean\" }, { \"name\":\"nullableList\", \"type\":[\"null\", " +
            "{ \"type\":\"array\", \"items\":\"int\"}] } ] } }";

    Schema s = buildSchema(field);
    GenericData.Record innerRecord = new GenericData.Record(s.getField("struct1").schema());

    innerRecord.put("sInt", 77);
    innerRecord.put("sBoolean", false);
    List<Integer> intList = new ArrayList<Integer>();
    Collections.addAll(intList, 1,2,3);
    innerRecord.put("nullableList", intList);

    GenericRecord r = serializeAndDeserialize(field, "struct1", innerRecord);
    Object result = r.get("struct1");
    assertNotSame(innerRecord, result);
    assertEquals(innerRecord, result);

    innerRecord.put("nullableList", null);
    r = serializeAndDeserialize(field, "struct1", innerRecord);
    result = r.get("struct1");
    assertNotSame(innerRecord, result);
    assertEquals(innerRecord, result);
  }
Verify that we can serialize an avro value by taking one, running it through
the deser process and then serialize it again.
serde/src/test/org/apache/hadoop/hive/serde2/avro/TestAvroSerializer.java