final String check = basedir + "data/avro/uncompressed/arraysAsOutputByPig.avro";
Set<GenericData.Record> records = getExpected(check);
assertEquals(3, records.size());
AvroBagWrapper size0 = null; // [ ]
AvroBagWrapper size1 = null; // [ 6 ]
AvroBagWrapper size5 = null; // [ 1, 2, 3, 4, 5 ]
// 3 arrays in records are in an arbitrary order. We re-order them by
// their size.
for (GenericData.Record record : records) {
AvroTupleWrapper tw = new AvroTupleWrapper<GenericData.Record>(record);
if (((AvroBagWrapper)tw.get(0)).size() == 0) {
size0 = (AvroBagWrapper)tw.get(0);
} else if (((AvroBagWrapper)tw.get(0)).size() == 1) {
size1 = (AvroBagWrapper)tw.get(0);
} else if (((AvroBagWrapper)tw.get(0)).size() == 5) {
size5 = (AvroBagWrapper)tw.get(0);
}
}
assertEquals(0, size0.size());
assertEquals(1, size1.size());
assertEquals(5, size5.size());
assertTrue(size0.compareTo(size0) == 0);
assertTrue(size0.compareTo(size1) < 0);
assertTrue(size0.compareTo(size5) < 0);
assertTrue(size1.compareTo(size0) > 0);